License | BSD-style |
---|---|
Maintainer | Haskell Foundation |
Safe Haskell | None |
Language | Haskell2010 |
Flexible Type convertion
From is multi parameter type class that allow converting from a to b.
Only type that are valid to convert to another type should be From instance; otherwise TryFrom should be used.
Into (resp TryInto) allows the contrary instances to be able to specify the destination type before the source. This is practical with TypeApplication
Documentation
Class of things that can be converted from a to b.
In a valid instance, the source should be always representable by the destination,
otherwise the instance should be using TryFrom
Class of things that can mostly be converted from a to b, but with possible error cases.
TryFrom (UArray Word8) String # | |
(NatWithinBound (CountOf ty) n, KnownNat n, PrimType ty) => TryFrom (Block ty) (BlockN n ty) # | |
(NatWithinBound (CountOf ty) n, KnownNat n, PrimType ty) => TryFrom (UArray ty) (BlockN n ty) # | |
(NatWithinBound (CountOf ty) n, KnownNat n, PrimType ty) => TryFrom (Array ty) (BlockN n ty) # | |
Same as from but reverse the type variable so that the destination type can be specified first
e.g. converting:
from _
Word (10 :: Int)
into @Word (10 :: Int)