Closed imz closed 7 years ago
My quick workaround in my code for now is like this:
{-# LANGUAGE StandaloneDeriving, DeriveGeneric #-}
import Control.Newtype
import Control.Monad.Identity
import GHC.Generics
deriving instance Generic (Identity a)
instance Newtype (Identity a)
Then I can write something like:
unsafeFromString =
under Identity
(\v' -> do (String t) <- v'
return t)
(as an implemntation of my (bad) idea how to suppress a warning about a non-exhaustive pattern match). It's here just to serve as an example.
Thanks for the suggestion! :+1: Fixed in https://github.com/jcristovao/newtype-generics/commit/3b803ac0cb87b214411a5cb6b52e4cac300b1c75.
In the documentation, it is claimed there are instances for the types from
base
.But I miss an instance for
Identity
from Control.Monad.Identity (which is actually defined and imported from Data.Functor.Identity frombase
).Can it be added without problems?