Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
Documentation
class Newtype n o | n -> o where Source #
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.
Instances
Newtype FilePathNT String Source # | |
Defined in Distribution.Parsec.Newtypes pack :: String -> FilePathNT Source # unpack :: FilePathNT -> String Source # | |
Newtype FreeText String Source # | |
Newtype Token' String Source # | |
Newtype Token String Source # | |
Newtype TestedWith (CompilerFlavor, VersionRange) Source # | |
Defined in Distribution.Parsec.Newtypes pack :: (CompilerFlavor, VersionRange) -> TestedWith Source # unpack :: TestedWith -> (CompilerFlavor, VersionRange) Source # | |
Newtype SpecLicense (Either License License) Source # | |
Defined in Distribution.Parsec.Newtypes | |
Newtype SpecVersion (Either Version VersionRange) Source # | |
Defined in Distribution.Parsec.Newtypes pack :: Either Version VersionRange -> SpecVersion Source # unpack :: SpecVersion -> Either Version VersionRange Source # | |
Newtype (Identity a) a Source # | |
Newtype (Sum a) a Source # | |
Newtype (Product a) a Source # | |
Newtype (MQuoted a) a Source # | |
Newtype (Endo a) (a -> a) Source # | |
Newtype (List sep wrapper a) [a] Source # | |
ala :: (Newtype n o, Newtype n' o') => (o -> n) -> ((o -> n) -> b -> n') -> b -> o' Source #
>>>
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