Tags: eunikolsky/podtime
Tags
[DOESN'T BUILD] Reduce instance boilerplate with lifting transformers' Note: this works in GHC, but fails to compile with GHCi! This is really bizarre. ``` ~/haskell/podtime/program/LiftMonadModTimeT.hs:14:9-42: error: Illegal datatype context (use DatatypeContexts): (forall i. Monad i => Monad (t i)) => | 14 | newtype (forall i. Monad i => Monad (t i)) => LiftMonadModTimeT t m a = LiftMonadModTimeT (t m a) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ~/haskell/podtime/program/LiftMonadDurationT.hs:14:9-42: error: Illegal datatype context (use DatatypeContexts): (forall i. Monad i => Monad (t i)) => | 14 | newtype (forall i. Monad i => Monad (t i)) => LiftMonadDurationT t m a = LiftMonadDurationT (t m a) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` Enabling `DatatypeContexts` complains about: ``` -XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language. ```
[DOESN'T BUILD] Reduce instance boilerplate with lifting transformers Note: this works in GHCi, but fails to compile with GHC! ``` ~/haskell/podtime/program/LiftMonadDurationT.hs:15:92: error: • Couldn't match kind ‘* -> *’ with ‘*’ Expected kind ‘* -> * -> *’, but ‘t’ has kind ‘(* -> *) -> * -> *’ • In the first argument of ‘LiftMonadDurationT’, namely ‘t’ In the first argument of ‘MonadDuration’, namely ‘(LiftMonadDurationT t m)’ In the instance declaration for ‘MonadDuration (LiftMonadDurationT t m)’ | 15 | instance (MonadDuration m, MonadTrans t, Monad (t m)) => MonadDuration (LiftMonadDurationT t m) where | ^ ~/haskell/podtime/program/LiftMonadDurationT.hs:15:94: error: • Expecting one more argument to ‘m’ Expected a type, but ‘m’ has kind ‘* -> *’ • In the second argument of ‘LiftMonadDurationT’, namely ‘m’ In the first argument of ‘MonadDuration’, namely ‘(LiftMonadDurationT t m)’ In the instance declaration for ‘MonadDuration (LiftMonadDurationT t m)’ | 15 | instance (MonadDuration m, MonadTrans t, Monad (t m)) => MonadDuration (LiftMonadDurationT t m) where | ^ ```
PreviousNext