Use `derive newtype instance` to save some boilerplate
This commit is contained in:
parent
734f231250
commit
80dc5b6a2c
|
@ -32,24 +32,12 @@ newtype UnifyT k f m a = MkUnifyT (StateT (UnificationState k f) m a)
|
||||||
|
|
||||||
derive instance Newtype (UnifyT k f m a) _
|
derive instance Newtype (UnifyT k f m a) _
|
||||||
derive instance Functor m => Functor (UnifyT k f m)
|
derive instance Functor m => Functor (UnifyT k f m)
|
||||||
|
derive newtype instance Monad m => Apply (UnifyT k f m)
|
||||||
instance Monad m => Apply (UnifyT k f m) where
|
derive newtype instance Monad m => Applicative (UnifyT k f m)
|
||||||
apply m1 m2 = MkUnifyT $ apply (un MkUnifyT m1) (un MkUnifyT m2)
|
derive newtype instance Monad m => Bind (UnifyT k f m)
|
||||||
|
|
||||||
instance Monad m => Applicative (UnifyT k f m) where
|
|
||||||
pure a = MkUnifyT $ pure a
|
|
||||||
|
|
||||||
instance Monad m => Bind (UnifyT k f m) where
|
|
||||||
bind m f = MkUnifyT $ (un MkUnifyT m) >>= (un MkUnifyT <<< f)
|
|
||||||
|
|
||||||
instance Monad m => Monad (UnifyT k f m)
|
instance Monad m => Monad (UnifyT k f m)
|
||||||
|
derive newtype instance (Monad m, Alt m) => Alt (UnifyT k f m)
|
||||||
instance (Monad m, Alt m) => Alt (UnifyT k f m) where
|
derive newtype instance (Monad m, Plus m) => Plus (UnifyT k f m)
|
||||||
alt = over2 MkUnifyT alt
|
|
||||||
|
|
||||||
instance (Monad m, Plus m) => Plus (UnifyT k f m) where
|
|
||||||
empty = MkUnifyT empty
|
|
||||||
|
|
||||||
instance (Monad m, Alternative m) => Alternative (UnifyT k f m)
|
instance (Monad m, Alternative m) => Alternative (UnifyT k f m)
|
||||||
instance (MonadPlus m) => MonadPlus (UnifyT k f m)
|
instance (MonadPlus m) => MonadPlus (UnifyT k f m)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue