lude

Haskell prelude alternative
git clone git://git.rr3.xyz/lude | git clone gits://git.rr3.xyz/lude
Log | Files | Refs | README | LICENSE

commit 5734a274aeb30dc1ddc4bd4eeb305f7d0f9e0e93
parent 106b54394f299710db6c25abb5853713a51c67d8
Author: Robert Russell <robert@rr3.xyz>
Date:   Fri, 16 Oct 2026 15:10:43 -0700

Development: init, with new Todo type

Diffstat:
Msrc/Lude.hs | 1+
Asrc/Lude/Development.hs | 29+++++++++++++++++++++++++++++
Msrc/Lude/Error.hs | 18------------------
Msrc/Lude/List.hs | 2--
4 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/src/Lude.hs b/src/Lude.hs @@ -5,6 +5,7 @@ module Lude ( import Lude.Algebra as X import Lude.Bool as X import Lude.Constraint as X +import Lude.Development as X import Lude.Equivalence as X import Lude.Error as X import Lude.Function as X diff --git a/src/Lude/Development.hs b/src/Lude/Development.hs @@ -0,0 +1,29 @@ +module Lude.Development ( + Todo, + unimplemented, + todo, +) where + +import Prelude qualified as Base + +import Lude.Haskell + +-------------------------------------------------------------------------------- + +{-# WARNING in "x-todo" Todo "todo left in code" #-} +type family Todo :: forall k. k where + +-------------------------------------------------------------------------------- + +type UnimplementedExn :: Type +newtype UnimplementedExn = MkUnimplementedExn Base.String + deriving stock (Base.Show) +instance Exception UnimplementedExn where + displayException (MkUnimplementedExn msg) = "unimplemented: " Base.++ msg + +unimplemented :: forall {r :: Repr} (a :: Type# r). (HasCallStack) => Base.String -> a +unimplemented msg = withFrozenCallStack (unsafe_raise (MkUnimplementedExn msg)) + +{-# WARNING in "x-todo" todo "todo left in code" #-} +todo :: forall {r :: Repr} (a :: Type# r). (HasCallStack) => a +todo = withFrozenCallStack (unimplemented "todo") diff --git a/src/Lude/Error.hs b/src/Lude/Error.hs @@ -10,9 +10,6 @@ module Lude.Error ( -- panic, impossible, - -- - unimplemented, - todo, ) where -- NOTE: `assert` is special (GHC can compile assertions to no-ops based on @@ -63,18 +60,3 @@ panic msg = withFrozenCallStack (unsafe_raise (MkPanicExn msg)) impossible :: forall {r :: Repr} (a :: Type# r). (HasCallStack) => a impossible = withFrozenCallStack (panic "impossible") - --------------------------------------------------------------------------------- - -type UnimplementedExn :: Type -newtype UnimplementedExn = MkUnimplementedExn Base.String - deriving stock (Base.Show) -instance Exception UnimplementedExn where - displayException (MkUnimplementedExn msg) = "unimplemented: " Base.++ msg - -unimplemented :: forall {r :: Repr} (a :: Type# r). (HasCallStack) => Base.String -> a -unimplemented msg = withFrozenCallStack (unsafe_raise (MkUnimplementedExn msg)) - -todo :: forall {r :: Repr} (a :: Type# r). (HasCallStack) => a -todo = withFrozenCallStack (unimplemented "todo") -{-# WARNING in "x-todo" todo "todo left in code" #-} diff --git a/src/Lude/List.hs b/src/Lude/List.hs @@ -9,8 +9,6 @@ import Lude.Haskell.List (List) import Lude.Maybe import Lude.Natural --- import Lude.Algebra.Magma - -- TODO: pindex, (!!) :: (Partial) => ... -- TODO: Somehow generalize indices beyond Natural (e.g., Nat64 should also work?)