From a77d5cadd45595328c7d7a78c22092ced9694bc9 Mon Sep 17 00:00:00 2001 From: Jan Beinke <git@janbeinke.com> Date: Mon, 3 Feb 2020 02:52:19 +0100 Subject: [PATCH] Add an internal prelude to make things easier --- package.yaml | 3 +++ src/BasePrelude.hs | 9 +++++++ src/Prelude.hs | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 src/BasePrelude.hs create mode 100644 src/Prelude.hs diff --git a/package.yaml b/package.yaml index 5de395d..687f783 100644 --- a/package.yaml +++ b/package.yaml @@ -59,6 +59,9 @@ ghc-options: library: source-dirs: src + other-modules: + - Prelude + - BasePrelude executables: qbar: diff --git a/src/BasePrelude.hs b/src/BasePrelude.hs new file mode 100644 index 0000000..0de4ba4 --- /dev/null +++ b/src/BasePrelude.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE PackageImports #-} +{-# LANGUAGE NoImplicitPrelude #-} + +module BasePrelude + ( module Prelude, + ) +where + +import "base" Prelude diff --git a/src/Prelude.hs b/src/Prelude.hs new file mode 100644 index 0000000..29aed66 --- /dev/null +++ b/src/Prelude.hs @@ -0,0 +1,62 @@ +{-# LANGUAGE NoImplicitPrelude #-} + +module Prelude + ( module BasePrelude, + head, + error, + errorWithoutStackTrace, + undefined, + Text.Text, + ByteString.ByteString, + trace, + traceId, + traceShow, + traceShowId, + Maybe.listToMaybe, + ) +where + +import BasePrelude hiding + ( error, + errorWithoutStackTrace, + head, + undefined, + ) +import qualified BasePrelude as P +import qualified Data.ByteString as ByteString +import qualified Data.Maybe as Maybe +import qualified Data.Text.Lazy as Text +import qualified Debug.Trace as Trace +import qualified GHC.Stack.Types + +{-# DEPRECATED head "Partial Function." #-} +head :: [a] -> a +head = P.head + +{-# DEPRECATED error "Partial Function." #-} +error :: GHC.Stack.Types.HasCallStack => String -> a +error = P.error + +{-# DEPRECATED errorWithoutStackTrace "Partial Function." #-} +errorWithoutStackTrace :: String -> a +errorWithoutStackTrace = P.errorWithoutStackTrace + +{-# DEPRECATED undefined "Partial Function." #-} +undefined :: GHC.Stack.Types.HasCallStack => a +undefined = P.undefined + +{-# DEPRECATED trace "Partitial Function." #-} +trace :: String -> a -> a +trace = Trace.trace + +{-# DEPRECATED traceId "Partitial Function." #-} +traceId :: String -> String +traceId = Trace.traceId + +{-# DEPRECATED traceShow "Partitial Function." #-} +traceShow :: Show a => a -> b -> b +traceShow = Trace.traceShow + +{-# DEPRECATED traceShowId "Partitial Function." #-} +traceShowId :: Show a => a -> a +traceShowId = Trace.traceShowId -- GitLab