{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE LinearTypes #-}
module Unsafe.Linear
(
coerce,
toLinear,
toLinear2,
toLinear3,
)
where
import qualified Unsafe.Coerce as NonLinear
import GHC.Exts (TYPE, RuntimeRep)
coerce :: a %1-> b
coerce :: forall a b. a %1 -> b
coerce = (Any -> Any) -> a %1 -> b
forall a b. a -> b
NonLinear.unsafeCoerce Any -> Any
forall a b. a -> b
NonLinear.unsafeCoerce
toLinear
:: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)
(a :: TYPE r1) (b :: TYPE r2) p.
(a %p-> b) %1-> (a %1-> b)
toLinear :: forall a b (p :: Multiplicity). (a %p -> b) %1 -> a %1 -> b
toLinear = (a %p -> b) %1 -> a %1 -> b
forall a b. a %1 -> b
coerce
toLinear2
:: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) (r3 :: RuntimeRep)
(a :: TYPE r1) (b :: TYPE r2) (c :: TYPE r3) p q.
(a %p-> b %q-> c) %1-> (a %1-> b %1-> c)
toLinear2 :: forall a b c (p :: Multiplicity) (q :: Multiplicity).
(a %p -> b %q -> c) %1 -> a %1 -> b %1 -> c
toLinear2 = (a %p -> b %q -> c) %1 -> a %1 -> b %1 -> c
forall a b. a %1 -> b
coerce
toLinear3
:: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)
(r3 :: RuntimeRep) (r4 :: RuntimeRep)
(a :: TYPE r1) (b :: TYPE r2) (c :: TYPE r3) (d :: TYPE r4) p q r.
(a %p-> b %q-> c %r-> d) %1-> (a %1-> b %1-> c %1-> d)
toLinear3 :: forall a b c d (p :: Multiplicity) (q :: Multiplicity)
(r :: Multiplicity).
(a %p -> b %q -> c %r -> d) %1 -> a %1 -> b %1 -> c %1 -> d
toLinear3 = (a %p -> b %q -> c %r -> d) %1 -> a %1 -> b %1 -> c %1 -> d
forall a b. a %1 -> b
coerce