Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Documentation
class Newtype n o | n -> o where #
The FunctionalDependencies
version of Newtype
type-class.
Note: for actual newtypes the implementation can be
pack = coerce; unpack = coerce
. We don't have default implementation,
because Cabal
have to support older than base >= 4.7
compilers.
Also, Newtype
could witness a non-structural isomorphism.
Newtype FilePathNT String # | |
Newtype FreeText String # | |
Newtype Token' String # | |
Newtype Token String # | |
Newtype TestedWith (CompilerFlavor, VersionRange) # | |
Newtype SpecLicense (Either License License) # | |
Newtype SpecVersion (Either Version VersionRange) # | |
Newtype (Identity a) a # | |
Newtype (Sum a) a # | |
Newtype (Product a) a # | |
Newtype (MQuoted a) a # | |
Newtype (Endo a) (a -> a) # | |
Newtype (List sep wrapper a) [a] # | |
ala :: (Newtype n o, Newtype n' o') => (o -> n) -> ((o -> n) -> b -> n') -> b -> o' #
>>>
ala Sum foldMap [1, 2, 3, 4 :: Int]
10
Note: the user supplied function for the newtype is ignored.
>>>
ala (Sum . (+1)) foldMap [1, 2, 3, 4 :: Int]
10