I want to create a different classes of side-effecty functions, so I can mark some of the side-effects as safer than other ones.
I'd like to create a newtype over the Fay
side-effect monad and use it in the do notation, so I declare it like this:
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE PackageImports #-}
import "base" Control.Monad
newtype ReadFay a = ReadFay { readFay :: Fay a } deriving Monad
A this point, the compiler cannot find the base
package. It is possible to do it in fay somehow?
I can still create my own versions of >>=
, return
, etc. for the ReadFay
, but being able to use it in do notation would be nice.
Or, is there a better way, how to create a different classes of side-effect than this my approach?