Safe Haskell | None |
---|---|
Language | Haskell2010 |
Proarrow.Category.Instance.Linear
Synopsis
- data LINEAR = L Type
- data Linear (a :: LINEAR) (b :: LINEAR) where
- data Forget a (b :: LINEAR) where
- data Ur a where
- counitUr :: Ur a %1 -> a
- dupUr :: Ur a %1 -> Ur (Ur a)
- data Free (a :: LINEAR) b where
- data Top where
- data With a b where
- urWith :: Ur (With a b) %1 -> (Ur a, Ur b)
- type Not a = a %1 -> ()
- not :: (Not b %1 -> Not a) %1 -> a %1 -> b
- not' :: (a %1 -> b) %1 -> Not b %1 -> Not a
- newtype Par a b = Par (Not (Not a, Not b))
- toPar :: (a, b) %1 -> Par a b
- pairFst :: (a, Par b c) %1 -> Par (a, b) c
- pairSnd :: (Par a b, c) %1 -> Par a (b, c)
- parAppL :: Par a b %1 -> Not a %1 -> b
- parAppR :: Par a b %1 -> Not b %1 -> a
- newtype Quest a = Quest (Not (Ur (Not a)))
- notQuest :: Not (Quest a) %1 -> Ur (Not a)
- unitQuest :: a %1 -> Quest a
- multQuest :: Quest (Quest a) %1 -> Quest a
- questPar :: Par (Quest a) (Quest b) %1 -> Quest (Either a b)
- dn :: Not (Not a) %1 -> a
- unsafeLinear :: (a -> b) %1 -> a %1 -> b
- unit :: 'L () ~> 'L (Par a (Not a))
- counit :: 'L (Not a, a) ~> 'L ()
- type (!~>) (p :: k -> k1 -> Type) (q :: k -> k1 -> Type) = forall (a :: k) (b :: k1). p a b %1 -> q a b
- data NegComp (p :: j +-> k) (q :: i +-> j) (a :: k) (c :: i) where
- newtype Neg (p :: k -> k1 -> Type) (a :: k1) (b :: k) = Neg (Not (p b a))
- getNeg :: forall {k1} {k2} p (a :: k2) (b :: k1). Neg p a b %1 -> Not (p b a)
- conv1 :: forall {k1} {k2} {k3} (p :: k1 +-> k2) (q :: k3 +-> k1) (a :: k2) (b :: k3). NegComp p q a b %1 -> Neg (Neg q :.: Neg p) a b
- conv2 :: forall {j} {i} {k} (q :: j -> i -> Type) (p :: k -> j -> Type) (a :: k) (b :: i). Neg (Neg q :.: Neg p) a b %1 -> NegComp p q a b
- asCocat :: forall {i} (p :: i -> i -> Type). ((Neg p :.: Neg p) !~> Neg p) -> p !~> NegComp p p
Documentation
Instances
data Linear (a :: LINEAR) (b :: LINEAR) where Source Comments #
data Forget a (b :: LINEAR) where Source Comments #
Instances
MonoidalProfunctor Forget Source Comments # | Forget is a lax monoidal functor |
Profunctor Forget Source Comments # | |
Representable Forget Source Comments # | |
Defined in Proarrow.Category.Instance.Linear | |
Adjunction Free Forget Source Comments # | |
MonoidalProfunctor (RepCostar Forget) Source Comments # | Forget is also a colax monoidal functor |
type Forget % (a :: LINEAR) Source Comments # | |
data Free (a :: LINEAR) b where Source Comments #
Instances
MonoidalProfunctor Free Source Comments # | Free is a lax monoidal functor |
Profunctor Free Source Comments # | |
Representable Free Source Comments # | |
Defined in Proarrow.Category.Instance.Linear | |
Adjunction Free Forget Source Comments # | |
MonoidalProfunctor (RepCostar Free) Source Comments # | Free is also a colax monoidal functor |
type Free % (a :: Type) Source Comments # | |
dn :: Not (Not a) %1 -> a Source Comments #
Double negation is possible with linear functions, though using unsafeDupablePerformIO
.
Derived from https://gist.github.com/ant-arctica/7563282c57d9d1ce0c4520c543187932
TODO: only tested in GHCi, might get ruined by optimizations
unsafeLinear :: (a -> b) %1 -> a %1 -> b Source Comments #
type (!~>) (p :: k -> k1 -> Type) (q :: k -> k1 -> Type) = forall (a :: k) (b :: k1). p a b %1 -> q a b Source Comments #
conv1 :: forall {k1} {k2} {k3} (p :: k1 +-> k2) (q :: k3 +-> k1) (a :: k2) (b :: k3). NegComp p q a b %1 -> Neg (Neg q :.: Neg p) a b Source Comments #