Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Documentation
Ur a
represents unrestricted values of type a
in a linear
context. The key idea is that because the contructor holds a
with a
regular arrow, a function that uses Ur a
linearly can use a
however it likes.
> someLinear :: Ur a %1-> (a,a)
> someLinear (Ur a) = (a,a)
Instances
Functor Ur Source # | |
Applicative Ur Source # | |
Foldable Ur Source # | |
Defined in Data.Unrestricted.Internal.Instances fold :: Monoid m => Ur m -> m # foldMap :: Monoid m => (a -> m) -> Ur a -> m # foldMap' :: Monoid m => (a -> m) -> Ur a -> m # foldr :: (a -> b -> b) -> b -> Ur a -> b # foldr' :: (a -> b -> b) -> b -> Ur a -> b # foldl :: (b -> a -> b) -> b -> Ur a -> b # foldl' :: (b -> a -> b) -> b -> Ur a -> b # foldr1 :: (a -> a -> a) -> Ur a -> a # foldl1 :: (a -> a -> a) -> Ur a -> a # elem :: Eq a => a -> Ur a -> Bool # maximum :: Ord a => Ur a -> a # | |
Traversable Ur Source # | |
Functor Ur Source # | |
Applicative Ur Source # | |
Storable a => Storable (Ur a) Source # | |
Consumable (Ur a) Source # | |
Defined in Data.Unrestricted.Internal.Instances | |
Dupable (Ur a) Source # | |
Movable (Ur a) Source # | |
Eq a => Eq (Ur a) Source # | |
Ord a => Ord (Ur a) Source # | |
KnownRepresentable a => KnownRepresentable (Ur a) Source # | |
Defined in Foreign.Marshal.Pure |
Get an a
out of an Ur a
. If you call this function on a
linearly bound Ur a
, then the a
you get out has to be used
linearly, for example:
restricted :: Ur a %1-> b restricted x = f (unur x) where -- f __must__ be linear f :: a %1-> b f x = ...