Portability | unportable |
---|---|
Maintainer | Michael Sloan (mgsloan@gmail.com) |
This module provides a template Haskell based mechanism for deriving instances of the Newtype class, defined in Control.Newtype. Example usage:
newtype CartesianList a = CartesianList [a] $(mkNewTypes [''CartesianList]) instance Monoid (CartesianList a) where mempty = pack [[]] a `mappend` b = pack [x ++ y | x <- unpack a, y <- unpack b]
*Main> print $ underF CartesianList (\xs -> [fold xs]) ([[[4],[5],[6]], [[1],[2]], [[0]]]) [[[4,1,0],[4,2,0],[5,1,0],[5,2,0],[6,1,0],[6,2,0]]]
- mkNewTypes :: [Name] -> Q [Dec]
Documentation
mkNewTypes :: [Name] -> Q [Dec]Source
Derive instances of Newtype, specified as a list of references to newtypes.