-
-
Notifications
You must be signed in to change notification settings - Fork 83
Closed
Labels
enhancementNew feature or requestNew feature or requestnewBring something new into library (add function or type or interface)Bring something new into library (add function or type or interface)
Milestone
Description
Just an experiment to have something like this:
class Newtype t where
type Un t :: Type
un :: t -> Un t
wrap :: Un t -> t
-- un . wrap = id
-- wrap . un = id
instance Newtype (Identity a) where
type Un (Identity a) = a
un = runIdentity
wrap = Identity
newtype Bar = Bar Int
deriving Newtype via (Identity Int)
And then we can write functions like these:
under :: Newtype t => (Un t -> Un t) -> t -> t
under f = wrap . f . un
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestnewBring something new into library (add function or type or interface)Bring something new into library (add function or type or interface)