HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulelinear-base-0.4.0Haskell2010

Data.Unrestricted.Linear.Internal.Ur

  • 1 type
  • 3 values
datadata Ur a where
#

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)

Constructors

Instances24Monad, Foldable, Traversable, Functor, Applicative, Generic1, …
  • Monad UrDefined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Ur
  • Functor UrDefined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Ur
  • Applicative UrDefined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Ur
  • Foldable UrDefined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Ur
  • Traversable UrDefined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Ur
  • Functor UrDefined in linear-base-0.4.0 · Data.Functor.Linear.Internal.Functor
  • Applicative UrDefined in linear-base-0.4.0 · Data.Functor.Linear.Internal.Applicative
  • Generic1 UrDefined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Ur
  • Generic1 UrDefined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Ur
  • Generic (Ur a)Defined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Ur
  • Storable a => Storable (Ur a)Defined in linear-base-0.4.0 · Foreign.Marshal.Pure.Internal · orphan
  • Generic (Ur a)Defined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Ur
  • Monoid a => Monoid (Ur a)Defined in linear-base-0.4.0 · Data.Monoid.Linear.Internal.Monoid

    Useful to treat unrestricted monoids as linear ones.

  • Consumable (Ur a)Defined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Consumable
  • Dupable (Ur a)Defined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Dupable
  • Semigroup a => Semigroup (Ur a)Defined in linear-base-0.4.0 · Data.Monoid.Linear.Internal.Semigroup

    Useful to treat unrestricted semigroups as linear ones.

  • Movable (Ur a)Defined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Movable
  • Eq a => Eq (Ur a)Defined in linear-base-0.4.0 · Data.Ord.Linear.Internal.Eq
  • Ord a => Ord (Ur a)Defined in linear-base-0.4.0 · Data.Ord.Linear.Internal.Ord
  • KnownRepresentable a => KnownRepresentable (Ur a)Defined in linear-base-0.4.0 · Foreign.Marshal.Pure.Internal
  • type Rep (Ur a) = D1 ('MetaData "Ur" "Data.Unrestricted.Linear.Internal.Ur" "linear-base-0.4.0-D8wukxS5KYmLhv3s1GSepB" 'False) (C1 ('MetaCons "Ur" 'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))Defined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Ur
  • type Rep1 Ur = D1 ('MetaData "Ur" "Data.Unrestricted.Linear.Internal.Ur" "linear-base-0.4.0-D8wukxS5KYmLhv3s1GSepB" 'False) (C1 ('MetaCons "Ur" 'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))Defined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Ur
  • type Rep (Ur a) = FixupMetaData (Ur a) (D1 Any (C1 Any (S1 Any (MP1 'Many (Rec0 a)))))Defined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Ur
  • type Rep1 Ur = FixupMetaData1 Ur (D1 Any (C1 Any (S1 Any (MP1 'Many Par1))))Defined in linear-base-0.4.0 · Data.Unrestricted.Linear.Internal.Ur
valueunur :: Ur a %1 -> a
#

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 = ...
valuelift :: (a -> b) -> Ur a %1 -> Ur b
#

Lifts a function on a linear Ur a.

valuelift2 :: (a -> b -> c) -> Ur a %1 -> Ur b %1 -> Ur c
#

Lifts a function to work on two linear Ur a.