Commit 738006a5 authored by Steffen Michels's avatar Steffen Michels

Merge branch '21-internal-overloading-of-bind-could-not-be-solved' into 'master'

Resolve #21: missing type contexts in Control.Monad

Closes #21

See merge request !68
parents ad17d96c 6a84e6d8
Pipeline #8119 passed with stage
in 1 minute and 53 seconds
......@@ -7,16 +7,16 @@ from Data.Maybe import :: Maybe
class Monad m | Applicative m where
bind :: !(m a) (a -> m b) -> m b
(>>=) infixl 1 :: (m a) (a -> m b) -> m b
(>>=) infixl 1 :: (m a) (a -> m b) -> m b | Monad m
(>>=) ma a2mb :== bind ma a2mb
(`b`) infixl 1 :: (m a) (a -> m b) -> m b
(`b`) infixl 1 :: (m a) (a -> m b) -> m b | Monad m
(`b`) ma a2mb :== bind ma a2mb
(>>|) infixl 1 :: (m a) (m b) -> m b | Monad m
(>>|) ma mb :== ma >>= \_ -> mb
(=<<) infixr 1 :: (a -> m b) (m a) -> m b
(=<<) infixr 1 :: (a -> m b) (m a) -> m b | Monad m
(=<<) f x :== x >>= f
instance Monad ((->) r)
......
......@@ -6,16 +6,16 @@ from StdFunc import const
class Functor f where
fmap :: (a -> b) !(f a) -> f b
(<$>) infixl 4 :: (a -> b) !(f a) -> f b
(<$>) infixl 4 :: (a -> b) !(f a) -> f b | Functor f
(<$>) f fa :== fmap f fa
(<$) infixl 4 :: a !(f b) -> f a
(<$) infixl 4 :: a !(f b) -> f a | Functor f
(<$) x fa :== fmap (const x) fa
($>) infixl 4 :: !(f b) a -> f a
($>) infixl 4 :: !(f b) a -> f a | Functor f
($>) fa x :== x <$ fa
void :: !(f a) -> f ()
void :: !(f a) -> f () | Functor f
void x :== () <$ x
instance Functor ((->) r)
......
......@@ -7,14 +7,14 @@ import qualified StdList
class Semigroup a where
mappend :: !a a -> a
mconcat :: !.[a] -> a
mconcat xs :== 'StdList'.foldr mappend mempty xs
(<++>) infixr 6 :: a a -> a | Semigroup a
(<++>) ma mb :== mappend ma mb
class Monoid a | Semigroup a where
mempty :: a
(<++>) infixr 6 :: a a -> a
(<++>) ma mb :== mappend ma mb
mconcat :: !.[a] -> a | Monoid a
mconcat xs :== 'StdList'.foldr mappend mempty xs
instance Semigroup [a]
instance Semigroup (a -> b) | Semigroup b
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment