Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
Documentation
class Newtype o n | n -> o where Source #
The FunctionalDependencies
version of Newtype
type-class.
Since Cabal-3.0 class arguments are in a different order than in newtype
package.
This change is to allow usage with DeriveAnyClass
(and DerivingStrategies
, in GHC-8.2).
Unfortunately one have to repeat inner type.
newtype New = New Old deriving anyclass (Newtype Old)
Another approach would be to use TypeFamilies
(and possibly
compute inner type using GHC.Generics), but we think FunctionalDependencies
version gives cleaner type signatures.
Nothing
Instances
Newtype String FilePathNT Source # | |
Defined in Distribution.FieldGrammar.Newtypes pack :: String -> FilePathNT Source # unpack :: FilePathNT -> String Source # | |
Newtype String Token' Source # | |
Newtype String Token Source # | |
Newtype CabalSpecVersion SpecVersion Source # | |
Defined in Distribution.FieldGrammar.Newtypes pack :: CabalSpecVersion -> SpecVersion Source # unpack :: SpecVersion -> CabalSpecVersion Source # | |
Newtype a (Product a) Source # | |
Newtype a (Sum a) Source # | |
Newtype a (Identity a) Source # | |
Newtype a (MQuoted a) Source # | |
Newtype [a] (List sep wrapper a) Source # | |
Newtype (Set a) (Set' sep wrapper a) Source # | |
Newtype (Either License License) SpecLicense Source # | |
Defined in Distribution.FieldGrammar.Newtypes | |
Newtype (CompilerFlavor, VersionRange) TestedWith Source # | |
Defined in Distribution.FieldGrammar.Newtypes pack :: (CompilerFlavor, VersionRange) -> TestedWith Source # unpack :: TestedWith -> (CompilerFlavor, VersionRange) Source # | |
Newtype (a -> a) (Endo a) Source # | |
ala :: (Newtype o n, Newtype o' n') => (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