{-# LANGUAGE DefaultSignatures #-}
module SimpleH.Classes where

import SimpleH.Core

class Functor f where
  map :: (a -> b) -> f a -> f b
class (Unit f, Functor f) => Applicative f where
  infixl 2 <*>
  (<*>) :: f (a -> b) -> f a -> f b
  default (<*>) :: Monad f => f (a -> b) -> f a -> f b
  fs <*> xs = fs >>= \f -> map f xs
class Applicative m => Monad m where
  join :: m (m a) -> m a
  join m = m >>= id
  infixl 1 >>=
  (>>=) :: m a -> (a -> m b) -> m b
  ma >>= k = join (map k ma)