commit 9ae81293f530b48d41e896fe11e8ac8dd1b7107b
parent 702418b9e19326d0d24ba8794f262305aa674860
Author: Robert Russell <robert@rr3.xyz>
Date: Fri, 9 Oct 2026 12:38:39 -0700
Error: add GHC.TypeError stuff
Diffstat:
1 file changed, 35 insertions(+), 0 deletions(-)
diff --git a/src/Lude/Error.hs b/src/Lude/Error.hs
@@ -1,8 +1,43 @@
module Lude.Error (
undefined,
error,
+ --
+ ErrorMessage,
+ ErrText,
+ ErrType,
+ type (!||),
+ type (!//),
+ TypeError,
) where
import Prelude (error, undefined)
+import GHC.TypeError qualified as GHC
+
+import Lude.Haskell
+
--------------------------------------------------------------------------------
+
+-- | An error message for custom type errors (see `TypeError`)
+type ErrorMessage :: Kind
+type ErrorMessage = GHC.ErrorMessage
+
+-- | Make an `ErrorMessage` showing text
+type ErrText :: Symbol -> ErrorMessage
+type ErrText = GHC.Text
+
+-- | Make an `ErrorMessage` showing a type
+type ErrType :: forall k. k -> ErrorMessage
+type ErrType = GHC.ShowType
+
+-- | Horizontally concatenate `ErrorMessage`s
+type (!||) :: Biendo ErrorMessage
+type (!||) = (GHC.:<>:)
+
+-- | Vertically concatenate `ErrorMessage`s
+type (!//) :: Biendo ErrorMessage
+type (!//) = (GHC.:$$:)
+
+-- | Produce a custom type error
+type TypeError :: forall k. ErrorMessage -> k
+type TypeError msg = GHC.TypeError msg