linear-base 0.4.0 → 0.5.0
raw patch · 51 files changed
+813/−531 lines, 51 filesdep +ghc-bignumdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: ghc-bignum
Dependency ranges changed: base
API changes (from Hackage documentation)
- Control.Functor.Linear: (<$) :: (Functor f, Consumable b) => a %1 -> f b %1 -> f a
- Control.Functor.Linear: (<$>) :: Functor f => (a %1 -> b) %1 -> f a %1 -> f b
- Control.Functor.Linear: (<&>) :: Functor f => f a %1 -> (a %1 -> b) %1 -> f b
- Control.Functor.Linear: (<*>) :: Applicative f => f (a %1 -> b) %1 -> f a %1 -> f b
- Control.Functor.Linear: (>>) :: Monad m => m () %1 -> m a %1 -> m a
- Control.Functor.Linear: (>>=) :: Monad m => m a %1 -> (a %1 -> m b) %1 -> m b
- Control.Functor.Linear: Data :: f a -> Data f a
- Control.Functor.Linear: ReaderT :: (r %1 -> m a) -> ReaderT r m a
- Control.Functor.Linear: StateT :: (s %1 -> m (a, s)) -> StateT s m a
- Control.Functor.Linear: ap :: Monad m => m (a %1 -> b) %1 -> m a %1 -> m b
- Control.Functor.Linear: ask :: Applicative m => ReaderT r m r
- Control.Functor.Linear: asks :: Monad m => (r %1 -> a) %1 -> ReaderT r m a
- Control.Functor.Linear: class (Applicative f, Functor f) => Applicative f
- Control.Functor.Linear: class (Functor f) => Functor f
- Control.Functor.Linear: class (Applicative m) => Monad m
- Control.Functor.Linear: class (Monad m) => MonadFail m
- Control.Functor.Linear: class (forall m. (Monad m) => Monad (t m)) => MonadTrans t
- Control.Functor.Linear: dataFmapDefault :: Functor f => (a %1 -> b) -> f a %1 -> f b
- Control.Functor.Linear: dataPureDefault :: Applicative f => a -> f a
- Control.Functor.Linear: evalState :: Consumable s => State s a %1 -> s %1 -> a
- Control.Functor.Linear: evalStateT :: (Functor m, Consumable s) => StateT s m a %1 -> s %1 -> m a
- Control.Functor.Linear: execState :: State s () %1 -> s %1 -> s
- Control.Functor.Linear: execStateT :: Functor m => StateT s m () %1 -> s %1 -> m s
- Control.Functor.Linear: fail :: MonadFail m => String -> m a
- Control.Functor.Linear: fmap :: Functor f => (a %1 -> b) %1 -> f a %1 -> f b
- Control.Functor.Linear: foldM :: forall m a b. Monad m => (b %1 -> a %1 -> m b) -> b %1 -> [a] %1 -> m b
- Control.Functor.Linear: get :: (Applicative m, Dupable s) => StateT s m s
- Control.Functor.Linear: gets :: (Applicative m, Dupable s) => (s %1 -> a) %1 -> StateT s m a
- Control.Functor.Linear: infixl 1 >>=
- Control.Functor.Linear: infixl 4 <*>
- Control.Functor.Linear: join :: Monad m => m (m a) %1 -> m a
- Control.Functor.Linear: lift :: (MonadTrans t, Monad m) => m a %1 -> t m a
- Control.Functor.Linear: liftA2 :: Applicative f => (a %1 -> b %1 -> c) %1 -> f a %1 -> f b %1 -> f c
- Control.Functor.Linear: local :: (r %1 -> r) %1 -> ReaderT r m a %1 -> ReaderT r m a
- Control.Functor.Linear: mapReader :: (a %1 -> b) %1 -> Reader r a %1 -> Reader r b
- Control.Functor.Linear: mapReaderT :: (m a %1 -> n b) %1 -> ReaderT r m a %1 -> ReaderT r n b
- Control.Functor.Linear: mapState :: ((a, s) %1 -> (b, s)) %1 -> State s a %1 -> State s b
- Control.Functor.Linear: mapStateT :: (m (a, s) %1 -> n (b, s)) %1 -> StateT s m a %1 -> StateT s n b
- Control.Functor.Linear: modify :: Applicative m => (s %1 -> s) %1 -> StateT s m ()
- Control.Functor.Linear: newtype Data f a
- Control.Functor.Linear: newtype ReaderT r m a
- Control.Functor.Linear: newtype StateT s m a
- Control.Functor.Linear: pure :: Applicative f => a %1 -> f a
- Control.Functor.Linear: put :: (Applicative m, Consumable s) => s %1 -> StateT s m ()
- Control.Functor.Linear: reader :: Monad m => (r %1 -> a) %1 -> ReaderT r m a
- Control.Functor.Linear: return :: Monad m => a %1 -> m a
- Control.Functor.Linear: runReader :: Reader r a %1 -> r %1 -> a
- Control.Functor.Linear: runReaderT :: ReaderT r m a %1 -> r %1 -> m a
- Control.Functor.Linear: runState :: State s a %1 -> s %1 -> (a, s)
- Control.Functor.Linear: runStateT :: StateT s m a %1 -> s %1 -> m (a, s)
- Control.Functor.Linear: state :: Applicative m => (s %1 -> (a, s)) %1 -> StateT s m a
- Control.Functor.Linear: type Reader r = ReaderT r Identity
- Control.Functor.Linear: type State s = StateT s Identity
- Control.Functor.Linear: void :: (Functor f, Consumable a) => f a %1 -> f ()
- Control.Functor.Linear: withReader :: (r' %1 -> r) %1 -> Reader r a %1 -> Reader r' a
- Control.Functor.Linear: withReaderT :: (r' %1 -> r) %1 -> ReaderT r m a %1 -> ReaderT r' m a
- Control.Functor.Linear: withState :: (s %1 -> s) %1 -> State s a %1 -> State s a
- Control.Functor.Linear: withStateT :: (s %1 -> s) %1 -> StateT s m a %1 -> StateT s m a
- Control.Monad.IO.Class.Linear: class (Monad m) => MonadIO m
- Control.Monad.IO.Class.Linear: instance Control.Monad.IO.Class.Linear.MonadIO System.IO.Linear.IO
- Control.Monad.IO.Class.Linear: liftIO :: MonadIO m => IO a %1 -> m a
- Control.Monad.IO.Class.Linear: liftSystemIO :: MonadIO m => IO a -> m a
- Control.Monad.IO.Class.Linear: liftSystemIOU :: MonadIO m => IO a -> m (Ur a)
- Control.Optics.Linear: Optical :: ((a `arr` b) -> s `arr` t) -> Optic_ arr s t a b
- Control.Optics.Linear: newtype Optic_ arr s t a b
- Control.Optics.Linear: type Optic c s t a b = forall arr. (c arr) => Optic_ arr s t a b
- Control.Optics.Linear.Iso: (.>) :: Optic_ arr s t a b -> Optic_ arr a b x y -> Optic_ arr s t x y
- Control.Optics.Linear.Iso: assoc :: SymmetricMonoidal m u => Iso (a `m` (b `m` c)) (d `m` (e `m` f)) ((a `m` b) `m` c) ((d `m` e) `m` f)
- Control.Optics.Linear.Iso: infixr 9 .>
- Control.Optics.Linear.Iso: iso :: (s %1 -> a) -> (b %1 -> t) -> Iso s t a b
- Control.Optics.Linear.Iso: swap :: SymmetricMonoidal m u => Iso (a `m` b) (c `m` d) (b `m` a) (d `m` c)
- Control.Optics.Linear.Iso: type Iso s t a b = Optic Profunctor s t a b
- Control.Optics.Linear.Iso: type Iso' s a = Iso s s a a
- Control.Optics.Linear.Iso: withIso :: Optic_ (Exchange a b) s t a b -> ((s %1 -> a) -> (b %1 -> t) -> r) -> r
- Control.Optics.Linear.Lens: (.>) :: Optic_ arr s t a b -> Optic_ arr a b x y -> Optic_ arr s t x y
- Control.Optics.Linear.Lens: _1 :: Lens (a, c) (b, c) a b
- Control.Optics.Linear.Lens: _2 :: Lens (c, a) (c, b) a b
- Control.Optics.Linear.Lens: get :: Optic_ (Kleisli (Const a)) s t a b -> s -> a
- Control.Optics.Linear.Lens: gets :: Optic_ (Kleisli (Const r)) s t a b -> (a -> r) -> s -> r
- Control.Optics.Linear.Lens: infixr 9 .>
- Control.Optics.Linear.Lens: lens :: (s %1 -> (a, b %1 -> t)) -> Lens s t a b
- Control.Optics.Linear.Lens: over :: Optic_ (FUN 'One) s t a b -> (a %1 -> b) -> s %1 -> t
- Control.Optics.Linear.Lens: overU :: Optic_ (->) s t a b -> (a -> b) -> s -> t
- Control.Optics.Linear.Lens: reifyLens :: Optic_ (Kleisli (Compose ((,) a) (FUN 'One b))) s t a b -> s %1 -> (a, b %1 -> t)
- Control.Optics.Linear.Lens: set :: Optic_ (->) s t a b -> b -> s -> t
- Control.Optics.Linear.Lens: setSwap :: Optic_ (Kleisli (Compose (FUN 'One b) ((,) a))) s t a b -> s %1 -> b %1 -> (a, t)
- Control.Optics.Linear.Lens: type Lens s t a b = Optic (Strong (,) ()) s t a b
- Control.Optics.Linear.Lens: type Lens' s a = Lens s s a a
- Control.Optics.Linear.Lens: withLens :: Optic_ (Kleisli (Compose ((,) a) (FUN 'One b))) s t a b -> (forall c. (s %1 -> (c, a)) -> ((c, b) %1 -> t) -> r) -> r
- Control.Optics.Linear.Prism: (.>) :: Optic_ arr s t a b -> Optic_ arr a b x y -> Optic_ arr s t x y
- Control.Optics.Linear.Prism: _Just :: Prism (Maybe a) (Maybe b) a b
- Control.Optics.Linear.Prism: _Left :: Prism (Either a c) (Either b c) a b
- Control.Optics.Linear.Prism: _Nothing :: Prism' (Maybe a) ()
- Control.Optics.Linear.Prism: _Right :: Prism (Either c a) (Either c b) a b
- Control.Optics.Linear.Prism: build :: Optic_ (CoKleisli (Const b)) s t a b -> b %1 -> t
- Control.Optics.Linear.Prism: infixr 9 .>
- Control.Optics.Linear.Prism: match :: Optic_ (Market a b) s t a b -> s %1 -> Either t a
- Control.Optics.Linear.Prism: prism :: (b %1 -> t) -> (s %1 -> Either t a) -> Prism s t a b
- Control.Optics.Linear.Prism: type Prism s t a b = Optic (Strong Either Void) s t a b
- Control.Optics.Linear.Prism: type Prism' s a = Prism s s a a
- Control.Optics.Linear.Prism: withPrism :: Optic_ (Market a b) s t a b -> ((b %1 -> t) -> (s %1 -> Either t a) -> r) -> r
- Control.Optics.Linear.Traversal: (.>) :: Optic_ arr s t a b -> Optic_ arr a b x y -> Optic_ arr s t x y
- Control.Optics.Linear.Traversal: infixr 9 .>
- Control.Optics.Linear.Traversal: over :: Optic_ (FUN 'One) s t a b -> (a %1 -> b) -> s %1 -> t
- Control.Optics.Linear.Traversal: overU :: Optic_ (->) s t a b -> (a -> b) -> s -> t
- Control.Optics.Linear.Traversal: traversal :: (forall f. Applicative f => (a %1 -> f b) -> s %1 -> f t) -> Traversal s t a b
- Control.Optics.Linear.Traversal: traverseOf :: Optic_ (Kleisli f) s t a b -> (a %1 -> f b) -> s %1 -> f t
- Control.Optics.Linear.Traversal: traverseOfU :: Optic_ (Kleisli f) s t a b -> (a -> f b) -> s -> f t
- Control.Optics.Linear.Traversal: traversed :: Traversable t => Traversal (t a) (t b) a b
- Control.Optics.Linear.Traversal: type Traversal s t a b = Optic Wandering s t a b
- Control.Optics.Linear.Traversal: type Traversal' s a = Traversal s s a a
- Data.Arity.Linear: S :: Peano -> Peano
- Data.Arity.Linear: Z :: Peano
- Data.Arity.Linear: class IsFunN a b f
- Data.Arity.Linear: data Peano
- Data.Arity.Linear: type family Arity b f
- Data.Array.Destination: alloc :: Int -> (DArray a %1 -> ()) %1 -> Vector a
- Data.Array.Destination: data DArray a
- Data.Array.Destination: dropEmpty :: HasCallStack => DArray a %1 -> ()
- Data.Array.Destination: fill :: HasCallStack => a %1 -> DArray a %1 -> ()
- Data.Array.Destination: fromFunction :: (Int -> b) -> DArray b %1 -> ()
- Data.Array.Destination: mirror :: HasCallStack => Vector a -> (a %1 -> b) -> DArray b %1 -> ()
- Data.Array.Destination: replicate :: a -> DArray a %1 -> ()
- Data.Array.Destination: size :: DArray a %1 -> (Ur Int, DArray a)
- Data.Array.Destination: split :: Int -> DArray a %1 -> (DArray a, DArray a)
- Data.Array.Mutable.Linear: alloc :: HasCallStack => Int -> a -> (Array a %1 -> Ur b) %1 -> Ur b
- Data.Array.Mutable.Linear: allocBeside :: Int -> a -> Array b %1 -> (Array a, Array b)
- Data.Array.Mutable.Linear: data Array a
- Data.Array.Mutable.Linear: freeze :: Array a %1 -> Ur (Vector a)
- Data.Array.Mutable.Linear: fromList :: HasCallStack => [a] -> (Array a %1 -> Ur b) %1 -> Ur b
- Data.Array.Mutable.Linear: get :: HasCallStack => Int -> Array a %1 -> (Ur a, Array a)
- Data.Array.Mutable.Linear: map :: (a -> b) -> Array a %1 -> Array b
- Data.Array.Mutable.Linear: read :: HasCallStack => Array a %1 -> Int -> (Ur a, Array a)
- Data.Array.Mutable.Linear: resize :: HasCallStack => Int -> a -> Array a %1 -> Array a
- Data.Array.Mutable.Linear: set :: HasCallStack => Int -> a -> Array a %1 -> Array a
- Data.Array.Mutable.Linear: size :: Array a %1 -> (Ur Int, Array a)
- Data.Array.Mutable.Linear: slice :: HasCallStack => Int -> Int -> Array a %1 -> (Array a, Array a)
- Data.Array.Mutable.Linear: toList :: Array a %1 -> Ur [a]
- Data.Array.Mutable.Linear: unsafeGet :: Int -> Array a %1 -> (Ur a, Array a)
- Data.Array.Mutable.Linear: unsafeRead :: Array a %1 -> Int -> (Ur a, Array a)
- Data.Array.Mutable.Linear: unsafeSet :: Int -> a -> Array a %1 -> Array a
- Data.Array.Mutable.Linear: unsafeWrite :: Array a %1 -> Int -> a -> Array a
- Data.Array.Mutable.Linear: write :: HasCallStack => Array a %1 -> Int -> a -> Array a
- Data.Array.Mutable.Unlifted.Linear: alloc :: Int -> a -> (Array# a %1 -> Ur b) %1 -> Ur b
- Data.Array.Mutable.Unlifted.Linear: allocBeside :: Int -> a -> Array# b %1 -> (# Array# a, Array# b #)
- Data.Array.Mutable.Unlifted.Linear: copyInto :: Int -> Array# a %1 -> Array# a %1 -> (# Array# a, Array# a #)
- Data.Array.Mutable.Unlifted.Linear: data Array# a
- Data.Array.Mutable.Unlifted.Linear: dup2 :: Array# a %1 -> (# Array# a, Array# a #)
- Data.Array.Mutable.Unlifted.Linear: freeze :: (Array# a -> b) -> Array# a %1 -> Ur b
- Data.Array.Mutable.Unlifted.Linear: get :: Int -> Array# a %1 -> (# Ur a, Array# a #)
- Data.Array.Mutable.Unlifted.Linear: infixr 0 `lseq`
- Data.Array.Mutable.Unlifted.Linear: lseq :: Array# a %1 -> b %1 -> b
- Data.Array.Mutable.Unlifted.Linear: map :: (a -> b) -> Array# a %1 -> Array# b
- Data.Array.Mutable.Unlifted.Linear: set :: Int -> a -> Array# a %1 -> Array# a
- Data.Array.Mutable.Unlifted.Linear: size :: Array# a %1 -> (# Ur Int, Array# a #)
- Data.Array.Mutable.Unlifted.Linear: toList :: Array# a %1 -> Ur [a]
- Data.Array.Mutable.Unlifted.Linear: unArray# :: (MutableArray# RealWorld a -> b) -> Array# a %1 -> Ur b
- Data.Array.Polarized: transfer :: Array a %1 -> Array a
- Data.Array.Polarized: walk :: Vector a %1 -> Array a
- Data.Array.Polarized.Pull: append :: Array a %1 -> Array a %1 -> Array a
- Data.Array.Polarized.Pull: asList :: Array a %1 -> [a]
- Data.Array.Polarized.Pull: data Array a
- Data.Array.Polarized.Pull: findLength :: Array a %1 -> (Int, Array a)
- Data.Array.Polarized.Pull: foldMap :: Monoid m => (a %1 -> m) -> Array a %1 -> m
- Data.Array.Polarized.Pull: foldr :: (a %1 -> b %1 -> b) -> b %1 -> Array a %1 -> b
- Data.Array.Polarized.Pull: fromFunction :: (Int -> a) -> Int -> Array a
- Data.Array.Polarized.Pull: fromVector :: Vector a %1 -> Array a
- Data.Array.Polarized.Pull: index :: Array a %1 -> Int -> (a, Array a)
- Data.Array.Polarized.Pull: make :: a -> Int -> Array a
- Data.Array.Polarized.Pull: reverse :: Array a %1 -> Array a
- Data.Array.Polarized.Pull: singleton :: a %1 -> Array a
- Data.Array.Polarized.Pull: split :: Int -> Array a %1 -> (Array a, Array a)
- Data.Array.Polarized.Pull: toVector :: Array a %1 -> Vector a
- Data.Array.Polarized.Pull: zip :: Array a %1 -> Array b %1 -> Array (a, b)
- Data.Array.Polarized.Pull: zipWith :: (a %1 -> b %1 -> c) -> Array a %1 -> Array b %1 -> Array c
- Data.Array.Polarized.Push: [Array] :: (forall m. Monoid m => (a -> m) -> m) -> Array a
- Data.Array.Polarized.Push: alloc :: Array a %1 -> Vector a
- Data.Array.Polarized.Push: cons :: a -> Array a %1 -> Array a
- Data.Array.Polarized.Push: data Array a
- Data.Array.Polarized.Push: foldMap :: Monoid b => (a -> b) -> Array a %1 -> b
- Data.Array.Polarized.Push: instance Data.Functor.Linear.Internal.Functor.Functor Data.Array.Polarized.Push.Array
- Data.Array.Polarized.Push: instance Data.Monoid.Linear.Internal.Monoid.Monoid (Data.Array.Polarized.Push.Array a)
- Data.Array.Polarized.Push: instance Data.Monoid.Linear.Internal.Monoid.Monoid (Data.Array.Polarized.Push.ArrayWriter a)
- Data.Array.Polarized.Push: instance Data.Monoid.Linear.Internal.Semigroup.Semigroup (Data.Array.Polarized.Push.Array a)
- Data.Array.Polarized.Push: instance Data.Monoid.Linear.Internal.Semigroup.Semigroup (Data.Array.Polarized.Push.ArrayWriter a)
- Data.Array.Polarized.Push: instance GHC.Base.Monoid (Data.Array.Polarized.Push.Array a)
- Data.Array.Polarized.Push: instance GHC.Base.Monoid (Data.Array.Polarized.Push.ArrayWriter a)
- Data.Array.Polarized.Push: instance GHC.Base.Semigroup (Data.Array.Polarized.Push.Array a)
- Data.Array.Polarized.Push: instance GHC.Base.Semigroup (Data.Array.Polarized.Push.ArrayWriter a)
- Data.Array.Polarized.Push: make :: HasCallStack => a -> Int -> Array a
- Data.Array.Polarized.Push: singleton :: a -> Array a
- Data.Array.Polarized.Push: snoc :: a -> Array a %1 -> Array a
- Data.Array.Polarized.Push: unzip :: Array (a, b) %1 -> (Array a, Array b)
- Data.Bifunctor.Linear: bimap :: Bifunctor p => (a %1 -> b) -> (c %1 -> d) -> (a `p` c) %1 -> b `p` d
- Data.Bifunctor.Linear: class Bifunctor p
- Data.Bifunctor.Linear: class (Bifunctor m) => SymmetricMonoidal (m :: Type -> Type -> Type) (u :: Type) | m -> u, u -> m
- Data.Bifunctor.Linear: first :: Bifunctor p => (a %1 -> b) -> (a `p` c) %1 -> b `p` c
- Data.Bifunctor.Linear: lassoc :: SymmetricMonoidal m u => (a `m` (b `m` c)) %1 -> (a `m` b) `m` c
- Data.Bifunctor.Linear: rassoc :: SymmetricMonoidal m u => ((a `m` b) `m` c) %1 -> a `m` (b `m` c)
- Data.Bifunctor.Linear: second :: Bifunctor p => (b %1 -> c) -> (a `p` b) %1 -> a `p` c
- Data.Bifunctor.Linear: swap :: SymmetricMonoidal m u => (a `m` b) %1 -> b `m` a
- Data.Bool.Linear: (&&) :: Bool %1 -> Bool %1 -> Bool
- Data.Bool.Linear: (||) :: Bool %1 -> Bool %1 -> Bool
- Data.Bool.Linear: False :: Bool
- Data.Bool.Linear: True :: Bool
- Data.Bool.Linear: data Bool
- Data.Bool.Linear: infixr 2 ||
- Data.Bool.Linear: infixr 3 &&
- Data.Bool.Linear: not :: Bool %1 -> Bool
- Data.Bool.Linear: otherwise :: Bool
- Data.Either.Linear: Left :: a -> Either a b
- Data.Either.Linear: Right :: b -> Either a b
- Data.Either.Linear: data Either a b
- Data.Either.Linear: either :: (a %1 -> c) -> (b %1 -> c) -> Either a b %1 -> c
- Data.Either.Linear: fromLeft :: (Consumable a, Consumable b) => a %1 -> Either a b %1 -> a
- Data.Either.Linear: fromRight :: (Consumable a, Consumable b) => b %1 -> Either a b %1 -> b
- Data.Either.Linear: lefts :: Consumable b => [Either a b] %1 -> [a]
- Data.Either.Linear: partitionEithers :: [Either a b] %1 -> ([a], [b])
- Data.Either.Linear: rights :: Consumable a => [Either a b] %1 -> [b]
- Data.Functor.Linear: (<$) :: (Functor f, Consumable b) => a -> f b %1 -> f a
- Data.Functor.Linear: (<$>) :: Functor f => (a %1 -> b) -> f a %1 -> f b
- Data.Functor.Linear: (<*>) :: Applicative f => f (a %1 -> b) %1 -> f a %1 -> f b
- Data.Functor.Linear: Const :: a -> Const a (b :: k)
- Data.Functor.Linear: [getConst] :: Const a (b :: k) -> a
- Data.Functor.Linear: class (Functor f) => Applicative f
- Data.Functor.Linear: class Functor f
- Data.Functor.Linear: class GTraversable t
- Data.Functor.Linear: class (Functor t) => Traversable t
- Data.Functor.Linear: fmap :: Functor f => (a %1 -> b) -> f a %1 -> f b
- Data.Functor.Linear: for :: (Traversable t, Applicative f) => t a %1 -> (a %1 -> f b) -> f (t b)
- Data.Functor.Linear: forM :: (Traversable t, Monad m) => t a %1 -> (a %1 -> m b) -> m (t b)
- Data.Functor.Linear: genericTraverse :: (Generic1 t, GTraversable (Rep1 t), Applicative f) => (a %1 -> f b) -> t a %1 -> f (t b)
- Data.Functor.Linear: infixl 4 <*>
- Data.Functor.Linear: liftA2 :: Applicative f => (a %1 -> b %1 -> c) -> f a %1 -> f b %1 -> f c
- Data.Functor.Linear: mapAccumL :: Traversable t => (a %1 -> b %1 -> (a, c)) -> a %1 -> t b %1 -> (a, t c)
- Data.Functor.Linear: mapAccumR :: Traversable t => (a %1 -> b %1 -> (a, c)) -> a %1 -> t b %1 -> (a, t c)
- Data.Functor.Linear: mapM :: (Traversable t, Monad m) => (a %1 -> m b) -> t a %1 -> m (t b)
- Data.Functor.Linear: newtype Const a (b :: k)
- Data.Functor.Linear: pure :: Applicative f => a -> f a
- Data.Functor.Linear: sequence :: (Traversable t, Applicative f) => t (f a) %1 -> f (t a)
- Data.Functor.Linear: sequenceA :: (Traversable t, Applicative f) => t (f a) %1 -> f (t a)
- Data.Functor.Linear: traverse :: (Traversable t, Applicative f) => (a %1 -> f b) -> t a %1 -> f (t b)
- Data.Functor.Linear: void :: (Functor f, Consumable a) => f a %1 -> f ()
- Data.HashMap.Mutable.Linear: alter :: Keyed k => (Maybe v -> Maybe v) -> k -> HashMap k v %1 -> HashMap k v
- Data.HashMap.Mutable.Linear: alterF :: (Keyed k, Functor f) => (Maybe v -> f (Ur (Maybe v))) -> k -> HashMap k v %1 -> f (HashMap k v)
- Data.HashMap.Mutable.Linear: capacity :: HashMap k v %1 -> (Ur Int, HashMap k v)
- Data.HashMap.Mutable.Linear: data HashMap k v
- Data.HashMap.Mutable.Linear: delete :: Keyed k => k -> HashMap k v %1 -> HashMap k v
- Data.HashMap.Mutable.Linear: empty :: forall k v b. Keyed k => Int -> (HashMap k v %1 -> Ur b) %1 -> Ur b
- Data.HashMap.Mutable.Linear: filter :: Keyed k => (v -> Bool) -> HashMap k v %1 -> HashMap k v
- Data.HashMap.Mutable.Linear: filterWithKey :: Keyed k => (k -> v -> Bool) -> HashMap k v %1 -> HashMap k v
- Data.HashMap.Mutable.Linear: fromList :: forall k v b. Keyed k => [(k, v)] -> (HashMap k v %1 -> Ur b) %1 -> Ur b
- Data.HashMap.Mutable.Linear: insert :: Keyed k => k -> v -> HashMap k v %1 -> HashMap k v
- Data.HashMap.Mutable.Linear: insertAll :: Keyed k => [(k, v)] -> HashMap k v %1 -> HashMap k v
- Data.HashMap.Mutable.Linear: intersectionWith :: Keyed k => (a -> b -> c) -> HashMap k a %1 -> HashMap k b %1 -> HashMap k c
- Data.HashMap.Mutable.Linear: lookup :: Keyed k => k -> HashMap k v %1 -> (Ur (Maybe v), HashMap k v)
- Data.HashMap.Mutable.Linear: mapMaybe :: Keyed k => (v -> Maybe v') -> HashMap k v %1 -> HashMap k v'
- Data.HashMap.Mutable.Linear: mapMaybeWithKey :: forall k v v'. Keyed k => (k -> v -> Maybe v') -> HashMap k v %1 -> HashMap k v'
- Data.HashMap.Mutable.Linear: member :: Keyed k => k -> HashMap k v %1 -> (Ur Bool, HashMap k v)
- Data.HashMap.Mutable.Linear: shrinkToFit :: Keyed k => HashMap k a %1 -> HashMap k a
- Data.HashMap.Mutable.Linear: size :: HashMap k v %1 -> (Ur Int, HashMap k v)
- Data.HashMap.Mutable.Linear: toList :: HashMap k v %1 -> Ur [(k, v)]
- Data.HashMap.Mutable.Linear: type Keyed k = (Eq k, Hashable k)
- Data.HashMap.Mutable.Linear: union :: Keyed k => HashMap k v %1 -> HashMap k v %1 -> HashMap k v
- Data.HashMap.Mutable.Linear: unionWith :: Keyed k => (v -> v -> v) -> HashMap k v %1 -> HashMap k v %1 -> HashMap k v
- Data.List.Linear: (++) :: [a] %1 -> [a] %1 -> [a]
- Data.List.Linear: all :: (a %1 -> Bool) -> [a] %1 -> Bool
- Data.List.Linear: and :: [Bool] %1 -> Bool
- Data.List.Linear: any :: (a %1 -> Bool) -> [a] %1 -> Bool
- Data.List.Linear: concat :: [[a]] %1 -> [a]
- Data.List.Linear: concatMap :: (a %1 -> [b]) -> [a] %1 -> [b]
- Data.List.Linear: cycle :: (HasCallStack, Dupable a) => [a] %1 -> [a]
- Data.List.Linear: drop :: Consumable a => Int -> [a] %1 -> [a]
- Data.List.Linear: dropWhile :: Dupable a => (a %1 -> Bool) -> [a] %1 -> [a]
- Data.List.Linear: filter :: Dupable a => (a %1 -> Bool) -> [a] %1 -> [a]
- Data.List.Linear: find :: Foldable t => (a -> Bool) -> t a -> Maybe a
- Data.List.Linear: foldMap :: Monoid m => (a %1 -> m) -> [a] %1 -> m
- Data.List.Linear: foldMap' :: Monoid m => (a %1 -> m) -> [a] %1 -> m
- Data.List.Linear: foldl :: (b %1 -> a %1 -> b) -> b %1 -> [a] %1 -> b
- Data.List.Linear: foldl' :: (b %1 -> a %1 -> b) -> b %1 -> [a] %1 -> b
- Data.List.Linear: foldl1 :: HasCallStack => (a %1 -> a %1 -> a) -> [a] %1 -> a
- Data.List.Linear: foldl1' :: HasCallStack => (a %1 -> a %1 -> a) -> [a] %1 -> a
- Data.List.Linear: foldr :: (a %1 -> b %1 -> b) -> b %1 -> [a] %1 -> b
- Data.List.Linear: foldr1 :: HasCallStack => (a %1 -> a %1 -> a) -> [a] %1 -> a
- Data.List.Linear: head :: [a] -> a
- Data.List.Linear: infixr 5 ++
- Data.List.Linear: init :: [a] -> [a]
- Data.List.Linear: insert :: Ord a => a -> [a] -> [a]
- Data.List.Linear: instance Data.Monoid.Linear.Internal.Monoid.Monoid [a]
- Data.List.Linear: instance Data.Monoid.Linear.Internal.Semigroup.Semigroup (GHC.Base.NonEmpty a)
- Data.List.Linear: instance Data.Monoid.Linear.Internal.Semigroup.Semigroup [a]
- Data.List.Linear: intercalate :: [a] -> [[a]] %1 -> [a]
- Data.List.Linear: intersperse :: a -> [a] %1 -> [a]
- Data.List.Linear: iterate :: Dupable a => (a %1 -> a) -> a %1 -> [a]
- Data.List.Linear: last :: [a] -> a
- Data.List.Linear: length :: [a] %1 -> (Ur Int, [a])
- Data.List.Linear: lookup :: Eq a => a -> [(a, b)] -> Maybe b
- Data.List.Linear: map :: (a %1 -> b) -> [a] %1 -> [b]
- Data.List.Linear: null :: Foldable t => t a -> Bool
- Data.List.Linear: or :: [Bool] %1 -> Bool
- Data.List.Linear: partition :: Dupable a => (a %1 -> Bool) -> [a] %1 -> ([a], [a])
- Data.List.Linear: product :: MultIdentity a => [a] %1 -> a
- Data.List.Linear: repeat :: Dupable a => a %1 -> [a]
- Data.List.Linear: replicate :: Dupable a => Int -> a %1 -> [a]
- Data.List.Linear: reverse :: [a] %1 -> [a]
- Data.List.Linear: scanl :: Dupable b => (b %1 -> a %1 -> b) -> b %1 -> [a] %1 -> [b]
- Data.List.Linear: scanl1 :: Dupable a => (a %1 -> a %1 -> a) -> [a] %1 -> [a]
- Data.List.Linear: scanr :: Dupable b => (a %1 -> b %1 -> b) -> b %1 -> [a] %1 -> [b]
- Data.List.Linear: scanr1 :: Dupable a => (a %1 -> a %1 -> a) -> [a] %1 -> [a]
- Data.List.Linear: sort :: Ord a => [a] -> [a]
- Data.List.Linear: sortOn :: Ord b => (a -> b) -> [a] -> [a]
- Data.List.Linear: span :: Dupable a => (a %1 -> Bool) -> [a] %1 -> ([a], [a])
- Data.List.Linear: splitAt :: Int -> [a] %1 -> ([a], [a])
- Data.List.Linear: sum :: AddIdentity a => [a] %1 -> a
- Data.List.Linear: tail :: [a] -> [a]
- Data.List.Linear: take :: Consumable a => Int -> [a] %1 -> [a]
- Data.List.Linear: takeWhile :: Dupable a => (a %1 -> Bool) -> [a] %1 -> [a]
- Data.List.Linear: transpose :: [[a]] %1 -> [[a]]
- Data.List.Linear: traverse' :: Applicative f => (a %1 -> f b) -> [a] %1 -> f [b]
- Data.List.Linear: uncons :: [a] %1 -> Maybe (a, [a])
- Data.List.Linear: unfoldr :: (b %1 -> Maybe (a, b)) -> b %1 -> [a]
- Data.List.Linear: unzip :: [(a, b)] %1 -> ([a], [b])
- Data.List.Linear: unzip3 :: [(a, b, c)] %1 -> ([a], [b], [c])
- Data.List.Linear: zip :: (Consumable a, Consumable b) => [a] %1 -> [b] %1 -> [(a, b)]
- Data.List.Linear: zip' :: [a] %1 -> [b] %1 -> ([(a, b)], Maybe (Either (NonEmpty a) (NonEmpty b)))
- Data.List.Linear: zip3 :: (Consumable a, Consumable b, Consumable c) => [a] %1 -> [b] %1 -> [c] %1 -> [(a, b, c)]
- Data.List.Linear: zipWith :: (Consumable a, Consumable b) => (a %1 -> b %1 -> c) -> [a] %1 -> [b] %1 -> [c]
- Data.List.Linear: zipWith' :: (a %1 -> b %1 -> c) -> [a] %1 -> [b] %1 -> ([c], Maybe (Either (NonEmpty a) (NonEmpty b)))
- Data.List.Linear: zipWith3 :: forall a b c d. (Consumable a, Consumable b, Consumable c) => (a %1 -> b %1 -> c %1 -> d) -> [a] %1 -> [b] %1 -> [c] %1 -> [d]
- Data.Maybe.Linear: Just :: a -> Maybe a
- Data.Maybe.Linear: Nothing :: Maybe a
- Data.Maybe.Linear: catMaybes :: [Maybe a] %1 -> [a]
- Data.Maybe.Linear: data Maybe a
- Data.Maybe.Linear: fromMaybe :: a -> Maybe a %1 -> a
- Data.Maybe.Linear: mapMaybe :: (a %1 -> Maybe b) -> [a] %1 -> [b]
- Data.Maybe.Linear: maybe :: b -> (a %1 -> b) -> Maybe a %1 -> b
- Data.Maybe.Linear: maybeToList :: Maybe a %1 -> [a]
- Data.Monoid.Linear: (<>) :: Semigroup a => a %1 -> a %1 -> a
- Data.Monoid.Linear: All :: Bool -> All
- Data.Monoid.Linear: Any :: Bool -> Any
- Data.Monoid.Linear: Dual :: a -> Dual a
- Data.Monoid.Linear: Endo :: (a %1 -> a) -> Endo a
- Data.Monoid.Linear: First :: a -> First a
- Data.Monoid.Linear: Last :: a -> Last a
- Data.Monoid.Linear: NonLinear :: a -> NonLinear a
- Data.Monoid.Linear: Product :: a -> Product a
- Data.Monoid.Linear: Sum :: a -> Sum a
- Data.Monoid.Linear: [getAll] :: All -> Bool
- Data.Monoid.Linear: [getAny] :: Any -> Bool
- Data.Monoid.Linear: [getDual] :: Dual a -> a
- Data.Monoid.Linear: [getFirst] :: First a -> a
- Data.Monoid.Linear: [getLast] :: Last a -> a
- Data.Monoid.Linear: [getProduct] :: Product a -> a
- Data.Monoid.Linear: [getSum] :: Sum a -> a
- Data.Monoid.Linear: appEndo :: Endo a %1 -> a %1 -> a
- Data.Monoid.Linear: class (Semigroup a) => Monoid a
- Data.Monoid.Linear: class Semigroup a
- Data.Monoid.Linear: infixr 6 <>
- Data.Monoid.Linear: mappend :: Monoid a => a %1 -> a %1 -> a
- Data.Monoid.Linear: mconcat :: Monoid a => [a] %1 -> a
- Data.Monoid.Linear: mempty :: Monoid a => a
- Data.Monoid.Linear: newtype All
- Data.Monoid.Linear: newtype Any
- Data.Monoid.Linear: newtype Dual a
- Data.Monoid.Linear: newtype Endo a
- Data.Monoid.Linear: newtype First a
- Data.Monoid.Linear: newtype Last a
- Data.Monoid.Linear: newtype NonLinear a
- Data.Monoid.Linear: newtype Product a
- Data.Monoid.Linear: newtype Sum a
- Data.Num.Linear: (*) :: Multiplicative a => a %1 -> a %1 -> a
- Data.Num.Linear: (+) :: Additive a => a %1 -> a %1 -> a
- Data.Num.Linear: (-) :: AdditiveGroup a => a %1 -> a %1 -> a
- Data.Num.Linear: Adding :: a -> Adding a
- Data.Num.Linear: Multiplying :: a -> Multiplying a
- Data.Num.Linear: abs :: Num a => a %1 -> a
- Data.Num.Linear: class (Additive a) => AddIdentity a
- Data.Num.Linear: class Additive a
- Data.Num.Linear: class (AddIdentity a) => AdditiveGroup a
- Data.Num.Linear: class FromInteger a
- Data.Num.Linear: class (Multiplicative a) => MultIdentity a
- Data.Num.Linear: class Multiplicative a
- Data.Num.Linear: class (Ring a, FromInteger a) => Num a
- Data.Num.Linear: class (AdditiveGroup a, Semiring a) => Ring a
- Data.Num.Linear: class (AddIdentity a, MultIdentity a) => Semiring a
- Data.Num.Linear: fromInteger :: FromInteger a => Integer %1 -> a
- Data.Num.Linear: getAdded :: Adding a %1 -> a
- Data.Num.Linear: getMultiplied :: Multiplying a %1 -> a
- Data.Num.Linear: infixl 6 -
- Data.Num.Linear: infixl 7 *
- Data.Num.Linear: instance (Data.Unrestricted.Linear.Internal.Movable.Movable a, GHC.Num.Num a) => Data.Num.Linear.AddIdentity (Data.Num.Linear.MovableNum a)
- Data.Num.Linear: instance (Data.Unrestricted.Linear.Internal.Movable.Movable a, GHC.Num.Num a) => Data.Num.Linear.Additive (Data.Num.Linear.MovableNum a)
- Data.Num.Linear: instance (Data.Unrestricted.Linear.Internal.Movable.Movable a, GHC.Num.Num a) => Data.Num.Linear.AdditiveGroup (Data.Num.Linear.MovableNum a)
- Data.Num.Linear: instance (Data.Unrestricted.Linear.Internal.Movable.Movable a, GHC.Num.Num a) => Data.Num.Linear.FromInteger (Data.Num.Linear.MovableNum a)
- Data.Num.Linear: instance (Data.Unrestricted.Linear.Internal.Movable.Movable a, GHC.Num.Num a) => Data.Num.Linear.MultIdentity (Data.Num.Linear.MovableNum a)
- Data.Num.Linear: instance (Data.Unrestricted.Linear.Internal.Movable.Movable a, GHC.Num.Num a) => Data.Num.Linear.Multiplicative (Data.Num.Linear.MovableNum a)
- Data.Num.Linear: instance (Data.Unrestricted.Linear.Internal.Movable.Movable a, GHC.Num.Num a) => Data.Num.Linear.Num (Data.Num.Linear.MovableNum a)
- Data.Num.Linear: instance (Data.Unrestricted.Linear.Internal.Movable.Movable a, GHC.Num.Num a) => Data.Num.Linear.Ring (Data.Num.Linear.MovableNum a)
- Data.Num.Linear: instance (Data.Unrestricted.Linear.Internal.Movable.Movable a, GHC.Num.Num a) => Data.Num.Linear.Semiring (Data.Num.Linear.MovableNum a)
- Data.Num.Linear: instance Data.Num.Linear.AddIdentity GHC.Types.Double
- Data.Num.Linear: instance Data.Num.Linear.AddIdentity GHC.Types.Int
- Data.Num.Linear: instance Data.Num.Linear.AddIdentity a => Data.Monoid.Linear.Internal.Monoid.Monoid (Data.Num.Linear.Adding a)
- Data.Num.Linear: instance Data.Num.Linear.AddIdentity a => Data.Monoid.Linear.Internal.Monoid.Monoid (Data.Semigroup.Internal.Sum a)
- Data.Num.Linear: instance Data.Num.Linear.AddIdentity a => GHC.Base.Monoid (Data.Num.Linear.Adding a)
- Data.Num.Linear: instance Data.Num.Linear.Additive GHC.Types.Double
- Data.Num.Linear: instance Data.Num.Linear.Additive GHC.Types.Int
- Data.Num.Linear: instance Data.Num.Linear.Additive a => Data.Monoid.Linear.Internal.Semigroup.Semigroup (Data.Num.Linear.Adding a)
- Data.Num.Linear: instance Data.Num.Linear.Additive a => Data.Monoid.Linear.Internal.Semigroup.Semigroup (Data.Semigroup.Internal.Sum a)
- Data.Num.Linear: instance Data.Num.Linear.Additive a => GHC.Base.Semigroup (Data.Num.Linear.Adding a)
- Data.Num.Linear: instance Data.Num.Linear.AdditiveGroup GHC.Types.Double
- Data.Num.Linear: instance Data.Num.Linear.AdditiveGroup GHC.Types.Int
- Data.Num.Linear: instance Data.Num.Linear.FromInteger GHC.Types.Double
- Data.Num.Linear: instance Data.Num.Linear.FromInteger GHC.Types.Int
- Data.Num.Linear: instance Data.Num.Linear.MultIdentity GHC.Types.Double
- Data.Num.Linear: instance Data.Num.Linear.MultIdentity GHC.Types.Int
- Data.Num.Linear: instance Data.Num.Linear.MultIdentity a => Data.Monoid.Linear.Internal.Monoid.Monoid (Data.Num.Linear.Multiplying a)
- Data.Num.Linear: instance Data.Num.Linear.MultIdentity a => Data.Monoid.Linear.Internal.Monoid.Monoid (Data.Semigroup.Internal.Product a)
- Data.Num.Linear: instance Data.Num.Linear.MultIdentity a => GHC.Base.Monoid (Data.Num.Linear.Multiplying a)
- Data.Num.Linear: instance Data.Num.Linear.Multiplicative GHC.Types.Double
- Data.Num.Linear: instance Data.Num.Linear.Multiplicative GHC.Types.Int
- Data.Num.Linear: instance Data.Num.Linear.Multiplicative a => Data.Monoid.Linear.Internal.Semigroup.Semigroup (Data.Num.Linear.Multiplying a)
- Data.Num.Linear: instance Data.Num.Linear.Multiplicative a => Data.Monoid.Linear.Internal.Semigroup.Semigroup (Data.Semigroup.Internal.Product a)
- Data.Num.Linear: instance Data.Num.Linear.Multiplicative a => GHC.Base.Semigroup (Data.Num.Linear.Multiplying a)
- Data.Num.Linear: instance Data.Num.Linear.Num GHC.Types.Double
- Data.Num.Linear: instance Data.Num.Linear.Num GHC.Types.Int
- Data.Num.Linear: instance Data.Num.Linear.Ring GHC.Types.Double
- Data.Num.Linear: instance Data.Num.Linear.Ring GHC.Types.Int
- Data.Num.Linear: instance Data.Num.Linear.Semiring GHC.Types.Double
- Data.Num.Linear: instance Data.Num.Linear.Semiring GHC.Types.Int
- Data.Num.Linear: instance Data.Unrestricted.Linear.Internal.Consumable.Consumable a => Data.Unrestricted.Linear.Internal.Consumable.Consumable (Data.Num.Linear.MovableNum a)
- Data.Num.Linear: instance Data.Unrestricted.Linear.Internal.Dupable.Dupable a => Data.Unrestricted.Linear.Internal.Dupable.Dupable (Data.Num.Linear.MovableNum a)
- Data.Num.Linear: instance Data.Unrestricted.Linear.Internal.Movable.Movable a => Data.Unrestricted.Linear.Internal.Movable.Movable (Data.Num.Linear.MovableNum a)
- Data.Num.Linear: instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Num.Linear.Adding a)
- Data.Num.Linear: instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Num.Linear.Multiplying a)
- Data.Num.Linear: instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Num.Linear.Adding a)
- Data.Num.Linear: instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Num.Linear.Multiplying a)
- Data.Num.Linear: instance GHC.Num.Num a => GHC.Num.Num (Data.Num.Linear.MovableNum a)
- Data.Num.Linear: instance GHC.Show.Show a => GHC.Show.Show (Data.Num.Linear.Adding a)
- Data.Num.Linear: instance GHC.Show.Show a => GHC.Show.Show (Data.Num.Linear.Multiplying a)
- Data.Num.Linear: negate :: AdditiveGroup a => a %1 -> a
- Data.Num.Linear: newtype Adding a
- Data.Num.Linear: newtype Multiplying a
- Data.Num.Linear: one :: MultIdentity a => a
- Data.Num.Linear: signum :: Num a => a %1 -> a
- Data.Num.Linear: zero :: AddIdentity a => a
- Data.Ord.Linear: (/=) :: Eq a => a %1 -> a %1 -> Bool
- Data.Ord.Linear: (<) :: Ord a => a %1 -> a %1 -> Bool
- Data.Ord.Linear: (<=) :: Ord a => a %1 -> a %1 -> Bool
- Data.Ord.Linear: (==) :: Eq a => a %1 -> a %1 -> Bool
- Data.Ord.Linear: (>) :: Ord a => a %1 -> a %1 -> Bool
- Data.Ord.Linear: (>=) :: Ord a => a %1 -> a %1 -> Bool
- Data.Ord.Linear: EQ :: Ordering
- Data.Ord.Linear: GT :: Ordering
- Data.Ord.Linear: LT :: Ordering
- Data.Ord.Linear: class Eq a
- Data.Ord.Linear: class (Eq a) => Ord a
- Data.Ord.Linear: compare :: Ord a => a %1 -> a %1 -> Ordering
- Data.Ord.Linear: data Ordering
- Data.Ord.Linear: infix 4 /=
- Data.Ord.Linear: max :: (Dupable a, Ord a) => a %1 -> a %1 -> a
- Data.Ord.Linear: min :: (Dupable a, Ord a) => a %1 -> a %1 -> a
- Data.Profunctor.Kleisli.Linear: CoKleisli :: (w a %1 -> b) -> CoKleisli w a b
- Data.Profunctor.Kleisli.Linear: Kleisli :: (a %1 -> m b) -> Kleisli m a b
- Data.Profunctor.Kleisli.Linear: [runCoKleisli] :: CoKleisli w a b -> w a %1 -> b
- Data.Profunctor.Kleisli.Linear: [runKleisli] :: Kleisli m a b -> a %1 -> m b
- Data.Profunctor.Kleisli.Linear: instance Control.Functor.Linear.Internal.Class.Applicative f => Data.Profunctor.Linear.Strong Data.Either.Either Data.Void.Void (Data.Profunctor.Kleisli.Linear.Kleisli f)
- Data.Profunctor.Kleisli.Linear: instance Control.Functor.Linear.Internal.Class.Applicative f => Data.Profunctor.Linear.Wandering (Data.Profunctor.Kleisli.Linear.Kleisli f)
- Data.Profunctor.Kleisli.Linear: instance Control.Functor.Linear.Internal.Class.Functor f => Data.Profunctor.Linear.Strong (,) () (Data.Profunctor.Kleisli.Linear.Kleisli f)
- Data.Profunctor.Kleisli.Linear: instance Data.Functor.Linear.Internal.Applicative.Applicative f => Data.Profunctor.Linear.Monoidal (,) () (Data.Profunctor.Kleisli.Linear.Kleisli f)
- Data.Profunctor.Kleisli.Linear: instance Data.Functor.Linear.Internal.Functor.Functor f => Data.Profunctor.Linear.Monoidal Data.Either.Either Data.Void.Void (Data.Profunctor.Kleisli.Linear.Kleisli f)
- Data.Profunctor.Kleisli.Linear: instance Data.Functor.Linear.Internal.Functor.Functor f => Data.Profunctor.Linear.Profunctor (Data.Profunctor.Kleisli.Linear.CoKleisli f)
- Data.Profunctor.Kleisli.Linear: instance Data.Functor.Linear.Internal.Functor.Functor f => Data.Profunctor.Linear.Profunctor (Data.Profunctor.Kleisli.Linear.Kleisli f)
- Data.Profunctor.Kleisli.Linear: instance Data.Profunctor.Linear.Strong Data.Either.Either Data.Void.Void (Data.Profunctor.Kleisli.Linear.CoKleisli (Data.Functor.Const.Const x))
- Data.Profunctor.Kleisli.Linear: newtype CoKleisli w a b
- Data.Profunctor.Kleisli.Linear: newtype Kleisli m a b
- Data.Profunctor.Linear: (***) :: Monoidal m u arr => (a `arr` b) -> (x `arr` y) -> (a `m` x) `arr` (b `m` y)
- Data.Profunctor.Linear: Exchange :: (s %1 -> a) -> (b %1 -> t) -> Exchange a b s t
- Data.Profunctor.Linear: Market :: (b %1 -> t) -> (s %1 -> Either t a) -> Market a b s t
- Data.Profunctor.Linear: class (SymmetricMonoidal m u, Profunctor arr) => Monoidal m u arr
- Data.Profunctor.Linear: class Profunctor (arr :: Type -> Type -> Type)
- Data.Profunctor.Linear: class (SymmetricMonoidal m u, Profunctor arr) => Strong m u arr
- Data.Profunctor.Linear: class (Strong (,) () arr, Strong Either Void arr) => Wandering arr
- Data.Profunctor.Linear: data Exchange a b s t
- Data.Profunctor.Linear: data Market a b s t
- Data.Profunctor.Linear: dimap :: Profunctor arr => (s %1 -> a) -> (b %1 -> t) -> (a `arr` b) -> s `arr` t
- Data.Profunctor.Linear: first :: Strong m u arr => (a `arr` b) -> (a `m` c) `arr` (b `m` c)
- Data.Profunctor.Linear: infixr 3 ***
- Data.Profunctor.Linear: instance Data.Profunctor.Linear.Monoidal (,) () (->)
- Data.Profunctor.Linear: instance Data.Profunctor.Linear.Monoidal (,) () (FUN 'One)
- Data.Profunctor.Linear: instance Data.Profunctor.Linear.Monoidal Data.Either.Either Data.Void.Void (->)
- Data.Profunctor.Linear: instance Data.Profunctor.Linear.Monoidal Data.Either.Either Data.Void.Void (FUN 'One)
- Data.Profunctor.Linear: instance Data.Profunctor.Linear.Profunctor (->)
- Data.Profunctor.Linear: instance Data.Profunctor.Linear.Profunctor (Data.Profunctor.Linear.Exchange a b)
- Data.Profunctor.Linear: instance Data.Profunctor.Linear.Profunctor (Data.Profunctor.Linear.Market a b)
- Data.Profunctor.Linear: instance Data.Profunctor.Linear.Profunctor (FUN 'One)
- Data.Profunctor.Linear: instance Data.Profunctor.Linear.Strong (,) () (->)
- Data.Profunctor.Linear: instance Data.Profunctor.Linear.Strong (,) () (FUN 'One)
- Data.Profunctor.Linear: instance Data.Profunctor.Linear.Strong Data.Either.Either Data.Void.Void (->)
- Data.Profunctor.Linear: instance Data.Profunctor.Linear.Strong Data.Either.Either Data.Void.Void (Data.Profunctor.Linear.Market a b)
- Data.Profunctor.Linear: instance Data.Profunctor.Linear.Strong Data.Either.Either Data.Void.Void (FUN 'One)
- Data.Profunctor.Linear: instance Data.Profunctor.Linear.Wandering (FUN 'One)
- Data.Profunctor.Linear: instance GHC.Base.Applicative f => Data.Profunctor.Linear.Monoidal (,) () (Control.Arrow.Kleisli f)
- Data.Profunctor.Linear: instance GHC.Base.Applicative f => Data.Profunctor.Linear.Strong Data.Either.Either Data.Void.Void (Control.Arrow.Kleisli f)
- Data.Profunctor.Linear: instance GHC.Base.Functor f => Data.Profunctor.Linear.Monoidal Data.Either.Either Data.Void.Void (Control.Arrow.Kleisli f)
- Data.Profunctor.Linear: instance GHC.Base.Functor f => Data.Profunctor.Linear.Profunctor (Control.Arrow.Kleisli f)
- Data.Profunctor.Linear: instance GHC.Base.Functor f => Data.Profunctor.Linear.Strong (,) () (Control.Arrow.Kleisli f)
- Data.Profunctor.Linear: lmap :: Profunctor arr => (s %1 -> a) -> (a `arr` t) -> s `arr` t
- Data.Profunctor.Linear: rmap :: Profunctor arr => (b %1 -> t) -> (s `arr` b) -> s `arr` t
- Data.Profunctor.Linear: runMarket :: Market a b s t %1 -> (b %1 -> t, s %1 -> Either t a)
- Data.Profunctor.Linear: second :: Strong m u arr => (b `arr` c) -> (a `m` b) `arr` (a `m` c)
- Data.Profunctor.Linear: unit :: Monoidal m u arr => u `arr` u
- Data.Profunctor.Linear: wander :: forall s t a b. Wandering arr => (forall f. Applicative f => (a %1 -> f b) -> s %1 -> f t) -> (a `arr` b) -> s `arr` t
- Data.Replicator.Linear: (<*>) :: Replicator (a %1 -> b) %1 -> Replicator a %1 -> Replicator b
- Data.Replicator.Linear: class Elim n a b
- Data.Replicator.Linear: consume :: Replicator a %1 -> ()
- Data.Replicator.Linear: data Replicator a
- Data.Replicator.Linear: duplicate :: Replicator a %1 -> Replicator (Replicator a)
- Data.Replicator.Linear: elim :: forall (n :: Nat) a b f. (Elim (NatToPeano n) a b, IsFunN a b f, f ~ FunN (NatToPeano n) a b, n ~ Arity b f) => f %1 -> Replicator a %1 -> b
- Data.Replicator.Linear: extend :: (Replicator a %1 -> b) -> Replicator a %1 -> Replicator b
- Data.Replicator.Linear: extract :: Replicator a %1 -> a
- Data.Replicator.Linear: infixl 4 <*>
- Data.Replicator.Linear: map :: (a %1 -> b) -> Replicator a %1 -> Replicator b
- Data.Replicator.Linear: next :: Replicator a %1 -> (a, Replicator a)
- Data.Replicator.Linear: next# :: Replicator a %1 -> (# a, Replicator a #)
- Data.Replicator.Linear: pure :: a -> Replicator a
- Data.Replicator.Linear: take :: Int -> Replicator a %1 -> [a]
- Data.Set.Mutable.Linear: data Set a
- Data.Set.Mutable.Linear: delete :: Keyed a => a -> Set a %1 -> Set a
- Data.Set.Mutable.Linear: empty :: Keyed a => Int -> (Set a %1 -> Ur b) %1 -> Ur b
- Data.Set.Mutable.Linear: fromList :: Keyed a => [a] -> (Set a %1 -> Ur b) %1 -> Ur b
- Data.Set.Mutable.Linear: insert :: Keyed a => a -> Set a %1 -> Set a
- Data.Set.Mutable.Linear: intersection :: Keyed a => Set a %1 -> Set a %1 -> Set a
- Data.Set.Mutable.Linear: member :: Keyed a => a -> Set a %1 -> (Ur Bool, Set a)
- Data.Set.Mutable.Linear: size :: Keyed a => Set a %1 -> (Ur Int, Set a)
- Data.Set.Mutable.Linear: toList :: Keyed a => Set a %1 -> Ur [a]
- Data.Set.Mutable.Linear: type Keyed a = Keyed a
- Data.Set.Mutable.Linear: union :: Keyed a => Set a %1 -> Set a %1 -> Set a
- Data.Tuple.Linear: curry :: ((a, b) %p -> c) %q -> a %p -> b %p -> c
- Data.Tuple.Linear: fst :: Consumable b => (a, b) %1 -> a
- Data.Tuple.Linear: snd :: Consumable a => (a, b) %1 -> b
- Data.Tuple.Linear: swap :: (a, b) %1 -> (b, a)
- Data.Tuple.Linear: uncurry :: (a %p -> b %p -> c) %q -> (a, b) %p -> c
- Data.Tuple.Linear.Compat: mkSolo :: a %p -> Solo a
- Data.Tuple.Linear.Compat: unSolo :: Solo a %p -> a
- Data.Unrestricted.Linear: AsMovable :: a -> AsMovable a
- Data.Unrestricted.Linear: MovableMonoid :: a -> MovableMonoid a
- Data.Unrestricted.Linear: UrT :: m (Ur a) -> UrT m a
- Data.Unrestricted.Linear: [Ur] :: a -> Ur a
- Data.Unrestricted.Linear: class Consumable a
- Data.Unrestricted.Linear: class (Consumable a) => Dupable a
- Data.Unrestricted.Linear: class (Dupable a) => Movable a
- Data.Unrestricted.Linear: consume :: Consumable a => a %1 -> ()
- Data.Unrestricted.Linear: data Ur a
- Data.Unrestricted.Linear: dup :: Dupable a => a %1 -> (a, a)
- Data.Unrestricted.Linear: dup2 :: Dupable a => a %1 -> (a, a)
- Data.Unrestricted.Linear: dup3 :: Dupable a => a %1 -> (a, a, a)
- Data.Unrestricted.Linear: dup4 :: Dupable a => a %1 -> (a, a, a, a)
- Data.Unrestricted.Linear: dup5 :: Dupable a => a %1 -> (a, a, a, a, a)
- Data.Unrestricted.Linear: dup6 :: Dupable a => a %1 -> (a, a, a, a, a, a)
- Data.Unrestricted.Linear: dup7 :: Dupable a => a %1 -> (a, a, a, a, a, a, a)
- Data.Unrestricted.Linear: dupR :: Dupable a => a %1 -> Replicator a
- Data.Unrestricted.Linear: evalUrT :: Functor m => UrT m a %1 -> m a
- Data.Unrestricted.Linear: infixr 0 `lseq`
- Data.Unrestricted.Linear: lift :: (a -> b) -> Ur a %1 -> Ur b
- Data.Unrestricted.Linear: lift2 :: (a -> b -> c) -> Ur a %1 -> Ur b %1 -> Ur c
- Data.Unrestricted.Linear: liftUrT :: (Movable a, Functor m) => m a %1 -> UrT m a
- Data.Unrestricted.Linear: lseq :: Consumable a => a %1 -> b %1 -> b
- Data.Unrestricted.Linear: move :: Movable a => a %1 -> Ur a
- Data.Unrestricted.Linear: newtype AsMovable a
- Data.Unrestricted.Linear: newtype MovableMonoid a
- Data.Unrestricted.Linear: newtype UrT m a
- Data.Unrestricted.Linear: runUrT :: UrT m a %1 -> m (Ur a)
- Data.Unrestricted.Linear: unur :: Ur a %1 -> a
- Data.V.Linear: (<*>) :: V n (a %1 -> b) %1 -> V n a %1 -> V n b
- Data.V.Linear: class Elim n a b
- Data.V.Linear: class Make m n a
- Data.V.Linear: cons :: forall n a. a %1 -> V (n - 1) a %1 -> V n a
- Data.V.Linear: consume :: V 0 a %1 -> ()
- Data.V.Linear: data V (n :: Nat) (a :: Type)
- Data.V.Linear: dupV :: forall n a. (KnownNat n, Dupable a) => a %1 -> V n a
- Data.V.Linear: elim :: forall (n :: Nat) a b f. (n ~ PeanoToNat (NatToPeano n), Elim (NatToPeano n) a b, IsFunN a b f, f ~ FunN (NatToPeano n) a b, n ~ Arity b f) => f %1 -> V n a %1 -> b
- Data.V.Linear: empty :: forall a. V 0 a
- Data.V.Linear: fromReplicator :: forall n a. KnownNat n => Replicator a %1 -> V n a
- Data.V.Linear: infixl 4 <*>
- Data.V.Linear: make :: forall (n :: Nat) a f. (n ~ PeanoToNat (NatToPeano n), Make (NatToPeano n) (NatToPeano n) a, IsFunN a (V n a) f, f ~ FunN (NatToPeano n) a (V n a), n ~ ArityV f) => f
- Data.V.Linear: map :: (a %1 -> b) -> V n a %1 -> V n b
- Data.V.Linear: pure :: forall n a. KnownNat n => a -> V n a
- Data.V.Linear: theLength :: forall n. KnownNat n => Int
- Data.V.Linear: type family ArityV f
- Data.V.Linear: uncons :: 1 <= n => V n a %1 -> (a, V (n - 1) a)
- Data.V.Linear: uncons# :: 1 <= n => V n a %1 -> (# a, V (n - 1) a #)
- Data.Vector.Mutable.Linear: capacity :: Vector a %1 -> (Ur Int, Vector a)
- Data.Vector.Mutable.Linear: constant :: HasCallStack => Int -> a -> (Vector a %1 -> Ur b) %1 -> Ur b
- Data.Vector.Mutable.Linear: data Vector a
- Data.Vector.Mutable.Linear: empty :: (Vector a %1 -> Ur b) %1 -> Ur b
- Data.Vector.Mutable.Linear: filter :: Vector a %1 -> (a -> Bool) -> Vector a
- Data.Vector.Mutable.Linear: freeze :: Vector a %1 -> Ur (Vector a)
- Data.Vector.Mutable.Linear: fromList :: HasCallStack => [a] -> (Vector a %1 -> Ur b) %1 -> Ur b
- Data.Vector.Mutable.Linear: get :: HasCallStack => Int -> Vector a %1 -> (Ur a, Vector a)
- Data.Vector.Mutable.Linear: mapMaybe :: Vector a %1 -> (a -> Maybe b) -> Vector b
- Data.Vector.Mutable.Linear: modify :: HasCallStack => (a -> (a, b)) -> Int -> Vector a %1 -> (Ur b, Vector a)
- Data.Vector.Mutable.Linear: modify_ :: HasCallStack => (a -> a) -> Int -> Vector a %1 -> Vector a
- Data.Vector.Mutable.Linear: pop :: Vector a %1 -> (Ur (Maybe a), Vector a)
- Data.Vector.Mutable.Linear: push :: a -> Vector a %1 -> Vector a
- Data.Vector.Mutable.Linear: read :: HasCallStack => Vector a %1 -> Int -> (Ur a, Vector a)
- Data.Vector.Mutable.Linear: set :: HasCallStack => Int -> a -> Vector a %1 -> Vector a
- Data.Vector.Mutable.Linear: shrinkToFit :: Vector a %1 -> Vector a
- Data.Vector.Mutable.Linear: size :: Vector a %1 -> (Ur Int, Vector a)
- Data.Vector.Mutable.Linear: slice :: Int -> Int -> Vector a %1 -> Vector a
- Data.Vector.Mutable.Linear: toList :: Vector a %1 -> Ur [a]
- Data.Vector.Mutable.Linear: unsafeGet :: HasCallStack => Int -> Vector a %1 -> (Ur a, Vector a)
- Data.Vector.Mutable.Linear: unsafeRead :: Vector a %1 -> Int -> (Ur a, Vector a)
- Data.Vector.Mutable.Linear: unsafeSet :: HasCallStack => Int -> a -> Vector a %1 -> Vector a
- Data.Vector.Mutable.Linear: unsafeWrite :: Vector a %1 -> Int -> a -> Vector a
- Data.Vector.Mutable.Linear: write :: HasCallStack => Vector a %1 -> Int -> a -> Vector a
- Debug.Trace.Linear: trace :: String %1 -> a %1 -> a
- Debug.Trace.Linear: traceEvent :: String %1 -> a %1 -> a
- Debug.Trace.Linear: traceEventIO :: String %1 -> IO ()
- Debug.Trace.Linear: traceIO :: String %1 -> IO ()
- Debug.Trace.Linear: traceId :: String %1 -> String
- Debug.Trace.Linear: traceM :: Applicative f => String %1 -> f ()
- Debug.Trace.Linear: traceMarker :: String %1 -> a %1 -> a
- Debug.Trace.Linear: traceMarkerIO :: String %1 -> IO ()
- Debug.Trace.Linear: traceShow :: Show a => a -> b %1 -> b
- Debug.Trace.Linear: traceShowM :: (Show a, Applicative f) => a -> f ()
- Debug.Trace.Linear: traceStack :: String %1 -> a %1 -> a
- Foreign.Marshal.Pure: alloc :: forall a. Representable a => a %1 -> Pool %1 -> Box a
- Foreign.Marshal.Pure: class KnownRepresentable a
- Foreign.Marshal.Pure: class (Representable b) => MkRepresentable a b | a -> b
- Foreign.Marshal.Pure: class (KnownRepresentable (AsKnown a)) => Representable a where {
- Foreign.Marshal.Pure: data Box a
- Foreign.Marshal.Pure: data Pool
- Foreign.Marshal.Pure: deconstruct :: Representable a => Box a %1 -> a
- Foreign.Marshal.Pure: ofKnown :: (Representable a, MkRepresentable a b, AsKnown a ~ AsKnown b) => AsKnown a %1 -> a
- Foreign.Marshal.Pure: ofRepr :: MkRepresentable a b => b %1 -> a
- Foreign.Marshal.Pure: toKnown :: (Representable a, MkRepresentable a b, AsKnown a ~ AsKnown b) => a %1 -> AsKnown a
- Foreign.Marshal.Pure: toRepr :: MkRepresentable a b => a %1 -> b
- Foreign.Marshal.Pure: type AsKnown a :: Type;
- Foreign.Marshal.Pure: withPool :: (Pool %1 -> Ur b) %1 -> Ur b
- Foreign.Marshal.Pure: }
- Prelude.Linear: ($!) :: forall {rep} a (b :: TYPE rep) p q. (a %p -> b) %q -> a %p -> b
- Prelude.Linear: ($) :: forall {rep} a (b :: TYPE rep) p q. (a %p -> b) %q -> a %p -> b
- Prelude.Linear: (&) :: forall {rep} a (b :: TYPE rep) p q. a %p -> (a %p -> b) %q -> b
- Prelude.Linear: (**) :: Floating a => a -> a -> a
- Prelude.Linear: (.) :: forall {rep} b (c :: TYPE rep) a q m n. (b %1 -> c) %q -> (a %1 -> b) %m -> a %n -> c
- Prelude.Linear: (/) :: Fractional a => a -> a -> a
- Prelude.Linear: (<*) :: (Applicative f, Consumable b) => f a %1 -> f b %1 -> f a
- Prelude.Linear: (^) :: (Num a, Integral b) => a -> b -> a
- Prelude.Linear: (^^) :: (Fractional a, Integral b) => a -> b -> a
- Prelude.Linear: [Ur] :: a -> Ur a
- Prelude.Linear: acos :: Floating a => a -> a
- Prelude.Linear: acosh :: Floating a => a -> a
- Prelude.Linear: appendFile :: FilePath -> String -> IO ()
- Prelude.Linear: asin :: Floating a => a -> a
- Prelude.Linear: asinh :: Floating a => a -> a
- Prelude.Linear: atan :: Floating a => a -> a
- Prelude.Linear: atan2 :: RealFloat a => a -> a -> a
- Prelude.Linear: atanh :: Floating a => a -> a
- Prelude.Linear: ceiling :: (RealFrac a, Integral b) => a -> b
- Prelude.Linear: class Bounded a
- Prelude.Linear: class Consumable a
- Prelude.Linear: class (Consumable a) => Dupable a
- Prelude.Linear: class Enum a
- Prelude.Linear: class Fractional a => Floating a
- Prelude.Linear: class Num a => Fractional a
- Prelude.Linear: class (Real a, Enum a) => Integral a
- Prelude.Linear: class (Dupable a) => Movable a
- Prelude.Linear: class Read a
- Prelude.Linear: class (Num a, Ord a) => Real a
- Prelude.Linear: class (RealFrac a, Floating a) => RealFloat a
- Prelude.Linear: class (Real a, Fractional a) => RealFrac a
- Prelude.Linear: class Show a
- Prelude.Linear: const :: a %q -> b -> a
- Prelude.Linear: consume :: Consumable a => a %1 -> ()
- Prelude.Linear: cos :: Floating a => a -> a
- Prelude.Linear: cosh :: Floating a => a -> a
- Prelude.Linear: curry :: ((a, b) %p -> c) %q -> a %p -> b %p -> c
- Prelude.Linear: data Char
- Prelude.Linear: data Double
- Prelude.Linear: data Float
- Prelude.Linear: data IO a
- Prelude.Linear: data Int
- Prelude.Linear: data Integer
- Prelude.Linear: data Ur a
- Prelude.Linear: data Word
- Prelude.Linear: decodeFloat :: RealFloat a => a -> (Integer, Int)
- Prelude.Linear: div :: Integral a => a -> a -> a
- Prelude.Linear: divMod :: Integral a => a -> a -> (a, a)
- Prelude.Linear: dup :: Dupable a => a %1 -> (a, a)
- Prelude.Linear: dup2 :: Dupable a => a %1 -> (a, a)
- Prelude.Linear: dup3 :: Dupable a => a %1 -> (a, a, a)
- Prelude.Linear: dupR :: Dupable a => a %1 -> Replicator a
- Prelude.Linear: encodeFloat :: RealFloat a => Integer -> Int -> a
- Prelude.Linear: enumFrom :: Enum a => a -> [a]
- Prelude.Linear: enumFromThen :: Enum a => a -> a -> [a]
- Prelude.Linear: enumFromThenTo :: Enum a => a -> a -> a -> [a]
- Prelude.Linear: enumFromTo :: Enum a => a -> a -> [a]
- Prelude.Linear: error :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => [Char] -> a
- Prelude.Linear: errorWithoutStackTrace :: forall (r :: RuntimeRep) (a :: TYPE r). [Char] -> a
- Prelude.Linear: even :: Integral a => a -> Bool
- Prelude.Linear: exp :: Floating a => a -> a
- Prelude.Linear: exponent :: RealFloat a => a -> Int
- Prelude.Linear: flip :: (a %p -> b %q -> c) %r -> b %q -> a %p -> c
- Prelude.Linear: floatDigits :: RealFloat a => a -> Int
- Prelude.Linear: floatRadix :: RealFloat a => a -> Integer
- Prelude.Linear: floatRange :: RealFloat a => a -> (Int, Int)
- Prelude.Linear: floor :: (RealFrac a, Integral b) => a -> b
- Prelude.Linear: forget :: forall {rep} a (b :: TYPE rep). (a %1 -> b) %1 -> a -> b
- Prelude.Linear: fromEnum :: Enum a => a -> Int
- Prelude.Linear: fromIntegral :: (Integral a, Num b) => a -> b
- Prelude.Linear: fromRational :: Fractional a => Rational -> a
- Prelude.Linear: fst :: (a, b) -> a
- Prelude.Linear: gcd :: Integral a => a -> a -> a
- Prelude.Linear: getChar :: IO Char
- Prelude.Linear: getContents :: IO String
- Prelude.Linear: getLine :: IO String
- Prelude.Linear: id :: a %q -> a
- Prelude.Linear: infixl 1 &
- Prelude.Linear: infixl 4 <*
- Prelude.Linear: infixl 7 /
- Prelude.Linear: infixr 0 `lseq`
- Prelude.Linear: infixr 8 ^^
- Prelude.Linear: infixr 9 .
- Prelude.Linear: interact :: (String -> String) -> IO ()
- Prelude.Linear: isDenormalized :: RealFloat a => a -> Bool
- Prelude.Linear: isIEEE :: RealFloat a => a -> Bool
- Prelude.Linear: isInfinite :: RealFloat a => a -> Bool
- Prelude.Linear: isNaN :: RealFloat a => a -> Bool
- Prelude.Linear: isNegativeZero :: RealFloat a => a -> Bool
- Prelude.Linear: lcm :: Integral a => a -> a -> a
- Prelude.Linear: lex :: ReadS String
- Prelude.Linear: log :: Floating a => a -> a
- Prelude.Linear: logBase :: Floating a => a -> a -> a
- Prelude.Linear: lseq :: Consumable a => a %1 -> b %1 -> b
- Prelude.Linear: maxBound :: Bounded a => a
- Prelude.Linear: minBound :: Bounded a => a
- Prelude.Linear: mod :: Integral a => a -> a -> a
- Prelude.Linear: move :: Movable a => a %1 -> Ur a
- Prelude.Linear: odd :: Integral a => a -> Bool
- Prelude.Linear: pi :: Floating a => a
- Prelude.Linear: pred :: Enum a => a -> a
- Prelude.Linear: print :: Show a => a -> IO ()
- Prelude.Linear: properFraction :: (RealFrac a, Integral b) => a -> (b, a)
- Prelude.Linear: putChar :: Char -> IO ()
- Prelude.Linear: putStr :: String -> IO ()
- Prelude.Linear: putStrLn :: String -> IO ()
- Prelude.Linear: quot :: Integral a => a -> a -> a
- Prelude.Linear: quotRem :: Integral a => a -> a -> (a, a)
- Prelude.Linear: read :: Read a => String -> a
- Prelude.Linear: readFile :: FilePath -> IO String
- Prelude.Linear: readIO :: Read a => String -> IO a
- Prelude.Linear: readList :: Read a => ReadS [a]
- Prelude.Linear: readLn :: Read a => IO a
- Prelude.Linear: readParen :: Bool -> ReadS a -> ReadS a
- Prelude.Linear: reads :: Read a => ReadS a
- Prelude.Linear: readsPrec :: Read a => Int -> ReadS a
- Prelude.Linear: realToFrac :: (Real a, Fractional b) => a -> b
- Prelude.Linear: recip :: Fractional a => a -> a
- Prelude.Linear: rem :: Integral a => a -> a -> a
- Prelude.Linear: round :: (RealFrac a, Integral b) => a -> b
- Prelude.Linear: scaleFloat :: RealFloat a => Int -> a -> a
- Prelude.Linear: seq :: a -> b %q -> b
- Prelude.Linear: show :: Show a => a -> String
- Prelude.Linear: showChar :: Char -> ShowS
- Prelude.Linear: showList :: Show a => [a] -> ShowS
- Prelude.Linear: showParen :: Bool -> ShowS -> ShowS
- Prelude.Linear: showString :: String -> ShowS
- Prelude.Linear: shows :: Show a => a -> ShowS
- Prelude.Linear: showsPrec :: Show a => Int -> a -> ShowS
- Prelude.Linear: significand :: RealFloat a => a -> a
- Prelude.Linear: sin :: Floating a => a -> a
- Prelude.Linear: sinh :: Floating a => a -> a
- Prelude.Linear: snd :: (a, b) -> b
- Prelude.Linear: sqrt :: Floating a => a -> a
- Prelude.Linear: subtract :: Num a => a -> a -> a
- Prelude.Linear: succ :: Enum a => a -> a
- Prelude.Linear: tan :: Floating a => a -> a
- Prelude.Linear: tanh :: Floating a => a -> a
- Prelude.Linear: toEnum :: Enum a => Int -> a
- Prelude.Linear: toInteger :: Integral a => a -> Integer
- Prelude.Linear: toRational :: Real a => a -> Rational
- Prelude.Linear: truncate :: (RealFrac a, Integral b) => a -> b
- Prelude.Linear: type FilePath = String
- Prelude.Linear: type Rational = Ratio Integer
- Prelude.Linear: type ReadS a = String -> [(a, String)]
- Prelude.Linear: type ShowS = String -> String
- Prelude.Linear: uncurry :: (a %p -> b %p -> c) %q -> (a, b) %p -> c
- Prelude.Linear: undefined :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a
- Prelude.Linear: until :: (a -> Bool) -> (a -> a) -> a -> a
- Prelude.Linear: unur :: Ur a %1 -> a
- Prelude.Linear: writeFile :: FilePath -> String -> IO ()
- Prelude.Linear.GenericUtil: type FixupMetaData (a :: Type) (g :: Type -> Type) = Fixup (Rep a) g
- Prelude.Linear.GenericUtil: type FixupMetaData1 (f :: k -> Type) (g :: k -> Type) = Fixup1 (Rep (f Any)) g
- Prelude.Linear.GenericUtil: type family RemoveMetaData (f :: k -> Type) :: k -> Type
- Prelude.Linear.Generically: unGenerically :: Generically a %1 -> a
- Prelude.Linear.Generically: unGenerically1 :: Generically1 f a %1 -> f a
- Prelude.Linear.Internal.Generically: Generically :: a -> Generically a
- Prelude.Linear.Internal.Generically: Generically1 :: f a -> Generically1 f a
- Prelude.Linear.Internal.Generically: newtype Generically a
- Prelude.Linear.Internal.Generically: newtype Generically1 f a
- Prelude.Linear.Unsatisfiable: class (Any) => Bottom
- Prelude.Linear.Unsatisfiable: class (Bottom, TypeError e) => Unsatisfiable (e :: ErrorMessage)
- Prelude.Linear.Unsatisfiable: unsatisfiable :: forall {rep} (a :: TYPE rep). Bottom => a
- Streaming.Linear: [:>] :: !a -> b -> Of a b
- Streaming.Linear: [Effect] :: m (Stream f m r) -> Stream f m r
- Streaming.Linear: [Return] :: r -> Stream f m r
- Streaming.Linear: [Step] :: !f (Stream f m r) -> Stream f m r
- Streaming.Linear: chunksOf :: forall f m r. (HasCallStack, Monad m, Functor f) => Int -> Stream f m r %1 -> Stream (Stream f m) m r
- Streaming.Linear: concats :: forall f m r. (Monad m, Functor f) => Stream (Stream f m) m r %1 -> Stream f m r
- Streaming.Linear: data Of a b
- Streaming.Linear: data Stream f m r
- Streaming.Linear: decompose :: forall f m r. (Monad m, Functor f) => Stream (Compose m f) m r %1 -> Stream f m r
- Streaming.Linear: delays :: forall f r. Applicative f => Double -> Stream f IO r
- Streaming.Linear: destroy :: forall f m r b. (Functor f, Monad m) => Stream f m r %1 -> (f b %1 -> b) -> (m b %1 -> b) -> (r %1 -> b) -> b
- Streaming.Linear: effect :: (Monad m, Functor f) => m (Stream f m r) %1 -> Stream f m r
- Streaming.Linear: expand :: forall f m r g h. (Monad m, Functor f) => (forall a b. (g a %1 -> b) -> f a %1 -> h b) -> Stream f m r %1 -> Stream g (Stream h m) r
- Streaming.Linear: expandPost :: forall f m r g h. (Monad m, Functor g) => (forall a b. (g a %1 -> b) -> f a %1 -> h b) -> Stream f m r %1 -> Stream g (Stream h m) r
- Streaming.Linear: groups :: forall f g m r. (Monad m, Functor f, Functor g) => Stream (Sum f g) m r %1 -> Stream (Sum (Stream f m) (Stream g m)) m r
- Streaming.Linear: hoistUnexposed :: forall f m n r. (Monad m, Functor f) => (forall a. m a %1 -> n a) -> Stream f m r %1 -> Stream f n r
- Streaming.Linear: infixr 5 :>
- Streaming.Linear: inspect :: forall f m r. Monad m => Stream f m r %1 -> m (Either r (f (Stream f m r)))
- Streaming.Linear: intercalates :: forall t m r x. (Monad m, Monad (t m), MonadTrans t, Consumable x) => t m x -> Stream (t m) m r %1 -> t m r
- Streaming.Linear: iterT :: (Functor f, Monad m) => (f (m a) %1 -> m a) -> Stream f m a %1 -> m a
- Streaming.Linear: iterTM :: (Functor f, Monad m, MonadTrans t, Monad (t m)) => (f (t m a) %1 -> t m a) -> Stream f m a %1 -> t m a
- Streaming.Linear: mapped :: forall f g m r. (Monad m, Functor f) => (forall x. f x %1 -> m (g x)) -> Stream f m r %1 -> Stream g m r
- Streaming.Linear: mappedPost :: forall m f g r. (Monad m, Functor g) => (forall x. f x %1 -> m (g x)) -> Stream f m r %1 -> Stream g m r
- Streaming.Linear: maps :: forall f g m r. (Monad m, Functor f) => (forall x. f x %1 -> g x) -> Stream f m r %1 -> Stream g m r
- Streaming.Linear: mapsM :: forall f g m r. (Monad m, Functor f) => (forall x. f x %1 -> m (g x)) -> Stream f m r %1 -> Stream g m r
- Streaming.Linear: mapsMPost :: forall m f g r. (Monad m, Functor g) => (forall x. f x %1 -> m (g x)) -> Stream f m r %1 -> Stream g m r
- Streaming.Linear: mapsM_ :: (Functor f, Monad m) => (forall x. f x %1 -> m x) -> Stream f m r %1 -> m r
- Streaming.Linear: mapsPost :: forall m f g r. (Monad m, Functor g) => (forall x. f x %1 -> g x) -> Stream f m r %1 -> Stream g m r
- Streaming.Linear: replicates :: (HasCallStack, Monad m, Functor f) => Int -> f () -> Stream f m ()
- Streaming.Linear: replicatesM :: forall f m. (Monad m, Functor f) => Int -> m (f ()) -> Stream f m ()
- Streaming.Linear: run :: Monad m => Stream m m r %1 -> m r
- Streaming.Linear: separate :: forall f g m r. (Monad m, Functor f, Functor g) => Stream (Sum f g) m r -> Stream f (Stream g m) r
- Streaming.Linear: splitsAt :: forall f m r. (HasCallStack, Monad m, Functor f) => Int -> Stream f m r %1 -> Stream f m (Stream f m r)
- Streaming.Linear: streamBuild :: (forall b. (r %1 -> b) -> (m b %1 -> b) -> (f b %1 -> b) -> b) -> Stream f m r
- Streaming.Linear: streamFold :: (Functor f, Monad m) => (r %1 -> b) -> (m b %1 -> b) -> (f b %1 -> b) -> Stream f m r %1 -> b
- Streaming.Linear: unfold :: (Monad m, Functor f) => (s %1 -> m (Either r (f s))) -> s %1 -> Stream f m r
- Streaming.Linear: unseparate :: (Monad m, Functor f, Functor g) => Stream f (Stream g m) r -> Stream (Sum f g) m r
- Streaming.Linear: untilJust :: forall f m r. (Monad m, Applicative f) => m (Maybe r) -> Stream f m r
- Streaming.Linear: unzips :: forall f g m r. (Monad m, Functor f, Functor g) => Stream (Compose f g) m r %1 -> Stream f (Stream g m) r
- Streaming.Linear: wrap :: (Monad m, Functor f) => f (Stream f m r) %1 -> Stream f m r
- Streaming.Linear: yields :: (Monad m, Functor f) => f r %1 -> Stream f m r
- Streaming.Prelude.Linear: [:>] :: !a -> b -> Of a b
- Streaming.Prelude.Linear: [Effect] :: m (Stream f m r) -> Stream f m r
- Streaming.Prelude.Linear: [Left3] :: a -> Either3 a b c
- Streaming.Prelude.Linear: [Middle3] :: b -> Either3 a b c
- Streaming.Prelude.Linear: [Return] :: r -> Stream f m r
- Streaming.Prelude.Linear: [Right3] :: c -> Either3 a b c
- Streaming.Prelude.Linear: [Step] :: !f (Stream f m r) -> Stream f m r
- Streaming.Prelude.Linear: all :: Monad m => (a -> Bool) -> Stream (Of a) m r %1 -> m (Of Bool r)
- Streaming.Prelude.Linear: all_ :: (Consumable r, Monad m) => (a -> Bool) -> Stream (Of a) m r %1 -> m Bool
- Streaming.Prelude.Linear: any :: Monad m => (a -> Bool) -> Stream (Of a) m r %1 -> m (Of Bool r)
- Streaming.Prelude.Linear: any_ :: (Consumable r, Monad m) => (a -> Bool) -> Stream (Of a) m r %1 -> m Bool
- Streaming.Prelude.Linear: break :: forall a m r. Monad m => (a -> Bool) -> Stream (Of a) m r %1 -> Stream (Of a) m (Stream (Of a) m r)
- Streaming.Prelude.Linear: breakWhen :: forall m a x b r. Monad m => (x -> a -> x) -> x -> (x -> b) -> (b -> Bool) -> Stream (Of a) m r %1 -> Stream (Of a) m (Stream (Of a) m r)
- Streaming.Prelude.Linear: breakWhen' :: Monad m => (a -> Bool) -> Stream (Of a) m r %1 -> Stream (Of a) m (Stream (Of a) m r)
- Streaming.Prelude.Linear: breaks :: forall a m r. Monad m => (a -> Bool) -> Stream (Of a) m r %1 -> Stream (Stream (Of a) m) m r
- Streaming.Prelude.Linear: catMaybes :: Monad m => Stream (Of (Maybe a)) m r %1 -> Stream (Of a) m r
- Streaming.Prelude.Linear: chain :: forall a m r y. (Monad m, Consumable y) => (a -> m y) -> Stream (Of a) m r %1 -> Stream (Of a) m r
- Streaming.Prelude.Linear: composeToSum :: Compose (Of Bool) f r -> Sum f f r
- Streaming.Prelude.Linear: cons :: Monad m => a -> Stream (Of a) m r %1 -> Stream (Of a) m r
- Streaming.Prelude.Linear: copy :: forall a m r. Monad m => Stream (Of a) m r %1 -> Stream (Of a) (Stream (Of a) m) r
- Streaming.Prelude.Linear: cycleN :: (Monad m, Consumable r) => Int -> Stream (Of a) m r -> Stream (Of a) m r
- Streaming.Prelude.Linear: cycleZip :: (Monad m, Consumable s) => Stream (Of a) m r %1 -> Stream (Of b) m s -> Stream (Of (a, b)) m (r, s)
- Streaming.Prelude.Linear: data Either3 a b c
- Streaming.Prelude.Linear: data Of a b
- Streaming.Prelude.Linear: data Stream f m r
- Streaming.Prelude.Linear: delay :: forall a r. Double -> Stream (Of a) IO r %1 -> Stream (Of a) IO r
- Streaming.Prelude.Linear: destroyExposed :: forall f m r b. (Functor f, Monad m) => Stream f m r %1 -> (f b %1 -> b) -> (m b %1 -> b) -> (r %1 -> b) -> b
- Streaming.Prelude.Linear: distinguish :: (a -> Bool) -> Of a r -> Sum (Of a) (Of a) r
- Streaming.Prelude.Linear: drained :: (Monad m, Monad (t m), Functor (t m), MonadTrans t) => t m (Stream (Of a) m r) %1 -> t m r
- Streaming.Prelude.Linear: drop :: forall a m r. (HasCallStack, Monad m) => Int -> Stream (Of a) m r %1 -> Stream (Of a) m r
- Streaming.Prelude.Linear: dropWhile :: forall a m r. Monad m => (a -> Bool) -> Stream (Of a) m r %1 -> Stream (Of a) m r
- Streaming.Prelude.Linear: duplicate :: forall a m r. Monad m => Stream (Of a) m r %1 -> Stream (Of a) (Stream (Of a) m) r
- Streaming.Prelude.Linear: each' :: Monad m => [a] -> Stream (Of a) m ()
- Streaming.Prelude.Linear: effects :: forall a m r. Monad m => Stream (Of a) m r %1 -> m r
- Streaming.Prelude.Linear: eitherToSum :: Of (Either a b) r -> Sum (Of a) (Of b) r
- Streaming.Prelude.Linear: elem :: forall a m r. (Monad m, Eq a) => a -> Stream (Of a) m r %1 -> m (Of Bool r)
- Streaming.Prelude.Linear: elem_ :: forall a m r. (Consumable r, Monad m, Eq a) => a -> Stream (Of a) m r %1 -> m Bool
- Streaming.Prelude.Linear: enumFromN :: (Monad m, Enum e) => Int -> e -> Stream (Of e) m ()
- Streaming.Prelude.Linear: enumFromThenN :: (Monad m, Enum e) => Int -> e -> e -> Stream (Of e) m ()
- Streaming.Prelude.Linear: enumFromThenZip :: (Monad m, Enum e) => Stream (Of a) m r %1 -> e -> e -> Stream (Of (a, e)) m r
- Streaming.Prelude.Linear: enumFromZip :: (Monad m, Enum e) => Stream (Of a) m r %1 -> e -> Stream (Of (a, e)) m r
- Streaming.Prelude.Linear: erase :: forall a m r. Monad m => Stream (Of a) m r %1 -> Stream Identity m r
- Streaming.Prelude.Linear: filter :: forall a m r. Monad m => (a -> Bool) -> Stream (Of a) m r %1 -> Stream (Of a) m r
- Streaming.Prelude.Linear: filterM :: forall a m r. Monad m => (a -> m Bool) -> Stream (Of a) m r %1 -> Stream (Of a) m r
- Streaming.Prelude.Linear: fold :: forall x a b m r. Monad m => (x -> a -> x) -> x -> (x -> b) -> Stream (Of a) m r %1 -> m (Of b r)
- Streaming.Prelude.Linear: foldM :: forall x a m b r. Monad m => (x %1 -> a -> m x) -> m x -> (x %1 -> m b) -> Stream (Of a) m r %1 -> m (b, r)
- Streaming.Prelude.Linear: foldM_ :: forall a m x b r. (Monad m, Consumable r) => (x %1 -> a -> m x) -> m x -> (x %1 -> m b) -> Stream (Of a) m r %1 -> m b
- Streaming.Prelude.Linear: fold_ :: forall x a b m r. (Monad m, Consumable r) => (x -> a -> x) -> x -> (x -> b) -> Stream (Of a) m r %1 -> m b
- Streaming.Prelude.Linear: foldrM :: forall a m r. Monad m => (a -> m r %1 -> m r) -> Stream (Of a) m r %1 -> m r
- Streaming.Prelude.Linear: foldrT :: forall a t m r. (Monad m, MonadTrans t, Monad (t m)) => (a -> t m r %1 -> t m r) -> Stream (Of a) m r %1 -> t m r
- Streaming.Prelude.Linear: for :: forall f m r a x. (Monad m, Functor f, Consumable x) => Stream (Of a) m r %1 -> (a -> Stream f m x) -> Stream f m r
- Streaming.Prelude.Linear: fromHandle :: Handle %1 -> Stream (Of Text) RIO ()
- Streaming.Prelude.Linear: group :: (Monad m, Eq a) => Stream (Of a) m r %1 -> Stream (Stream (Of a) m) m r
- Streaming.Prelude.Linear: groupBy :: forall a m r. Monad m => (a -> a -> Bool) -> Stream (Of a) m r %1 -> Stream (Stream (Of a) m) m r
- Streaming.Prelude.Linear: head :: Monad m => Stream (Of a) m r %1 -> m (Of (Maybe a) r)
- Streaming.Prelude.Linear: head_ :: (Consumable r, Monad m) => Stream (Of a) m r %1 -> m (Maybe a)
- Streaming.Prelude.Linear: hoist :: forall f m n r. (Monad m, Functor f) => (forall a. m a %1 -> n a) -> Stream f m r %1 -> Stream f n r
- Streaming.Prelude.Linear: infix 4 `elem`
- Streaming.Prelude.Linear: infixr 5 :>
- Streaming.Prelude.Linear: intersperse :: forall a m r. Monad m => a -> Stream (Of a) m r %1 -> Stream (Of a) m r
- Streaming.Prelude.Linear: iterateMN :: Monad m => Int -> (a -> m (Ur a)) -> m (Ur a) -> Stream (Of a) m ()
- Streaming.Prelude.Linear: iterateMZip :: Monad m => Stream (Of x) m r %1 -> (a -> m (Ur a)) -> m (Ur a) -> Stream (Of (x, a)) m r
- Streaming.Prelude.Linear: iterateN :: Monad m => Int -> (a -> a) -> a -> Stream (Of a) m ()
- Streaming.Prelude.Linear: iterateZip :: Monad m => Stream (Of x) m r -> (a -> a) -> a -> Stream (Of (x, a)) m r
- Streaming.Prelude.Linear: last :: Monad m => Stream (Of a) m r %1 -> m (Of (Maybe a) r)
- Streaming.Prelude.Linear: last_ :: (Consumable r, Monad m) => Stream (Of a) m r %1 -> m (Maybe a)
- Streaming.Prelude.Linear: length :: Monad m => Stream (Of a) m r %1 -> m (Of Int r)
- Streaming.Prelude.Linear: length_ :: (Consumable r, Monad m) => Stream (Of a) m r %1 -> m Int
- Streaming.Prelude.Linear: map :: Monad m => (a -> b) -> Stream (Of a) m r %1 -> Stream (Of b) m r
- Streaming.Prelude.Linear: mapM :: Monad m => (a -> m (Ur b)) -> Stream (Of a) m r %1 -> Stream (Of b) m r
- Streaming.Prelude.Linear: mapM_ :: forall a m b r. (Consumable b, Monad m) => (a -> m b) -> Stream (Of a) m r %1 -> m r
- Streaming.Prelude.Linear: mapMaybe :: forall a b m r. Monad m => (a -> Maybe b) -> Stream (Of a) m r %1 -> Stream (Of b) m r
- Streaming.Prelude.Linear: mapMaybeM :: forall a m b r. Monad m => (a -> m (Maybe (Ur b))) -> Stream (Of a) m r %1 -> Stream (Of b) m r
- Streaming.Prelude.Linear: mapped :: forall f g m r. (Monad m, Functor f) => (forall x. f x %1 -> m (g x)) -> Stream f m r %1 -> Stream g m r
- Streaming.Prelude.Linear: mappedPost :: forall m f g r. (Monad m, Functor g) => (forall x. f x %1 -> m (g x)) -> Stream f m r %1 -> Stream g m r
- Streaming.Prelude.Linear: maps :: forall f g m r. (Monad m, Functor f) => (forall x. f x %1 -> g x) -> Stream f m r %1 -> Stream g m r
- Streaming.Prelude.Linear: mapsMPost :: forall m f g r. (Monad m, Functor g) => (forall x. f x %1 -> m (g x)) -> Stream f m r %1 -> Stream g m r
- Streaming.Prelude.Linear: mapsPost :: forall m f g r. (Monad m, Functor g) => (forall x. f x %1 -> g x) -> Stream f m r %1 -> Stream g m r
- Streaming.Prelude.Linear: maximum :: (Monad m, Ord a) => Stream (Of a) m r %1 -> m (Of (Maybe a) r)
- Streaming.Prelude.Linear: maximum_ :: (Consumable r, Monad m, Ord a) => Stream (Of a) m r %1 -> m (Maybe a)
- Streaming.Prelude.Linear: mconcat :: (Monad m, Monoid w) => Stream (Of w) m r %1 -> m (Of w r)
- Streaming.Prelude.Linear: mconcat_ :: (Consumable r, Monad m, Monoid w) => Stream (Of w) m r %1 -> m w
- Streaming.Prelude.Linear: merge :: (Monad m, Ord a) => Stream (Of a) m r %1 -> Stream (Of a) m s %1 -> Stream (Of a) m (r, s)
- Streaming.Prelude.Linear: mergeBy :: forall m a r s. Monad m => (a -> a -> Ordering) -> Stream (Of a) m r %1 -> Stream (Of a) m s %1 -> Stream (Of a) m (r, s)
- Streaming.Prelude.Linear: mergeOn :: (Monad m, Ord b) => (a -> b) -> Stream (Of a) m r %1 -> Stream (Of a) m s %1 -> Stream (Of a) m (r, s)
- Streaming.Prelude.Linear: minimum :: (Monad m, Ord a) => Stream (Of a) m r %1 -> m (Of (Maybe a) r)
- Streaming.Prelude.Linear: minimum_ :: (Consumable r, Monad m, Ord a) => Stream (Of a) m r %1 -> m (Maybe a)
- Streaming.Prelude.Linear: next :: forall a m r. Monad m => Stream (Of a) m r %1 -> m (Either r (Ur a, Stream (Of a) m r))
- Streaming.Prelude.Linear: notElem :: (Monad m, Eq a) => a -> Stream (Of a) m r %1 -> m (Of Bool r)
- Streaming.Prelude.Linear: notElem_ :: (Consumable r, Monad m, Eq a) => a -> Stream (Of a) m r %1 -> m Bool
- Streaming.Prelude.Linear: nubInt :: Monad m => Stream (Of Int) m r %1 -> Stream (Of Int) m r
- Streaming.Prelude.Linear: nubIntOn :: forall m a r. Monad m => (a -> Int) -> Stream (Of a) m r %1 -> Stream (Of a) m r
- Streaming.Prelude.Linear: nubOrd :: (Monad m, Ord a) => Stream (Of a) m r %1 -> Stream (Of a) m r
- Streaming.Prelude.Linear: nubOrdOn :: forall m a b r. (Monad m, Ord b) => (a -> b) -> Stream (Of a) m r %1 -> Stream (Of a) m r
- Streaming.Prelude.Linear: partition :: forall a m r. Monad m => (a -> Bool) -> Stream (Of a) m r %1 -> Stream (Of a) (Stream (Of a) m) r
- Streaming.Prelude.Linear: partitionEithers :: Monad m => Stream (Of (Either a b)) m r %1 -> Stream (Of a) (Stream (Of b) m) r
- Streaming.Prelude.Linear: print :: Show a => Stream (Of a) IO r %1 -> IO r
- Streaming.Prelude.Linear: product :: (Monad m, Num a) => Stream (Of a) m r %1 -> m (Of a r)
- Streaming.Prelude.Linear: product_ :: (Monad m, Num a) => Stream (Of a) m () %1 -> m a
- Streaming.Prelude.Linear: read :: (Monad m, Read a) => Stream (Of String) m r %1 -> Stream (Of a) m r
- Streaming.Prelude.Linear: readFile :: FilePath -> Stream (Of Text) RIO ()
- Streaming.Prelude.Linear: readLnN :: Read a => Int -> Stream (Of a) IO ()
- Streaming.Prelude.Linear: readLnUntil :: Read a => (a -> Bool) -> Stream (Of a) IO ()
- Streaming.Prelude.Linear: readLnUntilM :: Read a => (a -> IO Bool) -> Stream (Of a) IO ()
- Streaming.Prelude.Linear: readLnZip :: Read a => Stream (Of x) IO r %1 -> Stream (Of (x, a)) IO r
- Streaming.Prelude.Linear: replicate :: (HasCallStack, Monad m) => Int -> a -> Stream (Of a) m ()
- Streaming.Prelude.Linear: replicateM :: Monad m => Int -> m (Ur a) -> Stream (Of a) m ()
- Streaming.Prelude.Linear: replicateZip :: Monad m => Stream (Of x) m r -> a -> Stream (Of (a, x)) m r
- Streaming.Prelude.Linear: reread :: Monad m => (s -> m (Ur (Maybe a))) -> s -> Stream (Of a) m ()
- Streaming.Prelude.Linear: scan :: forall a x b m r. Monad m => (x -> a -> x) -> x -> (x -> b) -> Stream (Of a) m r %1 -> Stream (Of b) m r
- Streaming.Prelude.Linear: scanM :: forall a x b m r. Monad m => (x %1 -> a -> m (Ur x)) -> m (Ur x) -> (x %1 -> m (Ur b)) -> Stream (Of a) m r %1 -> Stream (Of b) m r
- Streaming.Prelude.Linear: scanned :: forall a x b m r. Monad m => (x -> a -> x) -> x -> (x -> b) -> Stream (Of a) m r %1 -> Stream (Of (a, b)) m r
- Streaming.Prelude.Linear: separate :: forall m f g r. (Monad m, Functor f, Functor g) => Stream (Sum f g) m r -> Stream f (Stream g m) r
- Streaming.Prelude.Linear: sequence :: forall a m r. Monad m => Stream (Of (m (Ur a))) m r %1 -> Stream (Of a) m r
- Streaming.Prelude.Linear: show :: (Monad m, Show a) => Stream (Of a) m r %1 -> Stream (Of String) m r
- Streaming.Prelude.Linear: slidingWindow :: forall a b m. Monad m => Int -> Stream (Of a) m b %1 -> Stream (Of (Seq a)) m b
- Streaming.Prelude.Linear: span :: Monad m => (a -> Bool) -> Stream (Of a) m r %1 -> Stream (Of a) m (Stream (Of a) m r)
- Streaming.Prelude.Linear: split :: forall a m r. (Eq a, Monad m) => a -> Stream (Of a) m r %1 -> Stream (Stream (Of a) m) m r
- Streaming.Prelude.Linear: splitAt :: forall f m r. (Monad m, Functor f) => Int -> Stream f m r %1 -> Stream f m (Stream f m r)
- Streaming.Prelude.Linear: stdinLnN :: Int -> Stream (Of Text) IO ()
- Streaming.Prelude.Linear: stdinLnUntil :: (Text -> Bool) -> Stream (Of Text) IO ()
- Streaming.Prelude.Linear: stdinLnUntilM :: (Text -> IO Bool) -> Stream (Of Text) IO ()
- Streaming.Prelude.Linear: stdinLnZip :: Stream (Of x) IO r %1 -> Stream (Of (x, Text)) IO r
- Streaming.Prelude.Linear: stdoutLn :: Stream (Of Text) IO () %1 -> IO ()
- Streaming.Prelude.Linear: stdoutLn' :: forall r. Stream (Of Text) IO r %1 -> IO r
- Streaming.Prelude.Linear: store :: Monad m => (Stream (Of a) (Stream (Of a) m) r %1 -> t) -> Stream (Of a) m r %1 -> t
- Streaming.Prelude.Linear: subst :: (Monad m, Functor f, Consumable x) => (a -> f x) -> Stream (Of a) m r %1 -> Stream f m r
- Streaming.Prelude.Linear: sum :: (Monad m, Num a) => Stream (Of a) m r %1 -> m (Of a r)
- Streaming.Prelude.Linear: sumToCompose :: Sum f f r -> Compose (Of Bool) f r
- Streaming.Prelude.Linear: sumToEither :: Sum (Of a) (Of b) r -> Of (Either a b) r
- Streaming.Prelude.Linear: sum_ :: (Monad m, Num a) => Stream (Of a) m () %1 -> m a
- Streaming.Prelude.Linear: switch :: Sum f g r -> Sum g f r
- Streaming.Prelude.Linear: toHandle :: Handle %1 -> Stream (Of Text) RIO r %1 -> RIO (r, Handle)
- Streaming.Prelude.Linear: toList :: Monad m => Stream (Of a) m r %1 -> m (Of [a] r)
- Streaming.Prelude.Linear: toList_ :: Monad m => Stream (Of a) m () %1 -> m [a]
- Streaming.Prelude.Linear: type ZipResidual a b m r1 r2 = Either3 (r1, r2) (r1, Stream (Of b) m r2) (Stream (Of a) m r1, r2)
- Streaming.Prelude.Linear: type ZipResidual3 a b c m r1 r2 r3 = (Either r1 (Stream (Of a) m r1), Either r2 (Stream (Of b) m r2), Either r3 (Stream (Of c) m r3))
- Streaming.Prelude.Linear: uncons :: forall a m r. (Consumable r, Monad m) => Stream (Of a) m r %1 -> m (Maybe (a, Stream (Of a) m r))
- Streaming.Prelude.Linear: unfoldr :: Monad m => (s %1 -> m (Either r (Ur a, s))) -> s %1 -> Stream (Of a) m r
- Streaming.Prelude.Linear: unseparate :: (Monad m, Functor f, Functor g) => Stream f (Stream g m) r -> Stream (Sum f g) m r
- Streaming.Prelude.Linear: untilRight :: forall m a r. Monad m => m (Either (Ur a) r) -> Stream (Of a) m r
- Streaming.Prelude.Linear: unzip :: Monad m => Stream (Of (a, b)) m r %1 -> Stream (Of a) (Stream (Of b) m) r
- Streaming.Prelude.Linear: with :: forall f m r a x. (Monad m, Functor f, Consumable x) => Stream (Of a) m r %1 -> (a -> f x) -> Stream f m r
- Streaming.Prelude.Linear: wrapEffect :: (Monad m, Functor f, Consumable y) => m a -> (a %1 -> m y) -> Stream f m r %1 -> Stream f m r
- Streaming.Prelude.Linear: writeFile :: FilePath -> Stream (Of Text) RIO r %1 -> RIO r
- Streaming.Prelude.Linear: yield :: Monad m => a -> Stream (Of a) m ()
- Streaming.Prelude.Linear: zip :: Monad m => Stream (Of a) m r1 %1 -> Stream (Of b) m r2 %1 -> Stream (Of (a, b)) m (r1, r2)
- Streaming.Prelude.Linear: zip3 :: Monad m => Stream (Of a) m r1 %1 -> Stream (Of b) m r2 %1 -> Stream (Of c) m r3 %1 -> Stream (Of (a, b, c)) m (r1, r2, r3)
- Streaming.Prelude.Linear: zip3R :: Monad m => Stream (Of a) m r1 %1 -> Stream (Of b) m r2 %1 -> Stream (Of c) m r3 %1 -> Stream (Of (a, b, c)) m (ZipResidual3 a b c m r1 r2 r3)
- Streaming.Prelude.Linear: zipR :: Monad m => Stream (Of a) m r1 %1 -> Stream (Of b) m r2 %1 -> Stream (Of (a, b)) m (ZipResidual a b m r1 r2)
- Streaming.Prelude.Linear: zipWith :: Monad m => (a -> b -> c) -> Stream (Of a) m r1 %1 -> Stream (Of b) m r2 %1 -> Stream (Of c) m (r1, r2)
- Streaming.Prelude.Linear: zipWith3 :: Monad m => (a -> b -> c -> d) -> Stream (Of a) m r1 %1 -> Stream (Of b) m r2 %1 -> Stream (Of c) m r3 %1 -> Stream (Of d) m (r1, r2, r3)
- Streaming.Prelude.Linear: zipWith3R :: Monad m => (a -> b -> c -> d) -> Stream (Of a) m r1 %1 -> Stream (Of b) m r2 %1 -> Stream (Of c) m r3 %1 -> Stream (Of d) m (ZipResidual3 a b c m r1 r2 r3)
- Streaming.Prelude.Linear: zipWithR :: Monad m => (a -> b -> c) -> Stream (Of a) m r1 %1 -> Stream (Of b) m r2 %1 -> Stream (Of c) m (ZipResidual a b m r1 r2)
- System.IO.Linear: IO :: (State# RealWorld %1 -> (# State# RealWorld, a #)) -> IO a
- System.IO.Linear: catch :: Exception e => IO (Ur a) -> (e -> IO (Ur a)) -> IO (Ur a)
- System.IO.Linear: fromSystemIO :: IO a %1 -> IO a
- System.IO.Linear: fromSystemIOU :: IO a -> IO (Ur a)
- System.IO.Linear: instance Control.Functor.Linear.Internal.Class.Applicative System.IO.Linear.IO
- System.IO.Linear: instance Control.Functor.Linear.Internal.Class.Functor System.IO.Linear.IO
- System.IO.Linear: instance Control.Functor.Linear.Internal.Class.Monad System.IO.Linear.IO
- System.IO.Linear: instance Data.Functor.Linear.Internal.Applicative.Applicative System.IO.Linear.IO
- System.IO.Linear: instance Data.Functor.Linear.Internal.Functor.Functor System.IO.Linear.IO
- System.IO.Linear: instance Data.Monoid.Linear.Internal.Monoid.Monoid a => Data.Monoid.Linear.Internal.Monoid.Monoid (System.IO.Linear.IO a)
- System.IO.Linear: instance Data.Monoid.Linear.Internal.Semigroup.Semigroup a => Data.Monoid.Linear.Internal.Semigroup.Semigroup (System.IO.Linear.IO a)
- System.IO.Linear: mask_ :: IO a -> IO a
- System.IO.Linear: newIORef :: a -> IO (Ur (IORef a))
- System.IO.Linear: newtype IO a
- System.IO.Linear: readIORef :: IORef a -> IO (Ur a)
- System.IO.Linear: throwIO :: Exception e => e -> IO a
- System.IO.Linear: withLinearIO :: IO (Ur a) -> IO a
- System.IO.Linear: writeIORef :: IORef a -> a -> IO ()
- System.IO.Resource.Linear: AbsoluteSeek :: SeekMode
- System.IO.Resource.Linear: AppendMode :: IOMode
- System.IO.Resource.Linear: ReadMode :: IOMode
- System.IO.Resource.Linear: ReadWriteMode :: IOMode
- System.IO.Resource.Linear: RelativeSeek :: SeekMode
- System.IO.Resource.Linear: SeekFromEnd :: SeekMode
- System.IO.Resource.Linear: WriteMode :: IOMode
- System.IO.Resource.Linear: data IOMode
- System.IO.Resource.Linear: data RIO a
- System.IO.Resource.Linear: data Resource a
- System.IO.Resource.Linear: data SeekMode
- System.IO.Resource.Linear: hClose :: Handle %1 -> RIO ()
- System.IO.Resource.Linear: hGetChar :: Handle %1 -> RIO (Ur Char, Handle)
- System.IO.Resource.Linear: hGetLine :: Handle %1 -> RIO (Ur Text, Handle)
- System.IO.Resource.Linear: hIsEOF :: Handle %1 -> RIO (Ur Bool, Handle)
- System.IO.Resource.Linear: hPutChar :: Handle %1 -> Char -> RIO Handle
- System.IO.Resource.Linear: hPutStr :: Handle %1 -> Text -> RIO Handle
- System.IO.Resource.Linear: hPutStrLn :: Handle %1 -> Text -> RIO Handle
- System.IO.Resource.Linear: hSeek :: Handle %1 -> SeekMode -> Integer -> RIO Handle
- System.IO.Resource.Linear: hTell :: Handle %1 -> RIO (Ur Integer, Handle)
- System.IO.Resource.Linear: openBinaryFile :: FilePath -> IOMode -> RIO Handle
- System.IO.Resource.Linear: openFile :: FilePath -> IOMode -> RIO Handle
- System.IO.Resource.Linear: release :: Resource a %1 -> RIO ()
- System.IO.Resource.Linear: run :: RIO (Ur a) -> IO a
- System.IO.Resource.Linear: type Handle = Resource Handle
- System.IO.Resource.Linear: type UnsafeResource = Resource
- System.IO.Resource.Linear: unsafeAcquire :: IO (Ur a) -> (a -> IO ()) -> RIO (Resource a)
- System.IO.Resource.Linear: unsafeFromSystemIOResource :: (a -> IO b) -> Resource a %1 -> RIO (Ur b, Resource a)
- System.IO.Resource.Linear: unsafeFromSystemIOResource_ :: (a -> IO ()) -> Resource a %1 -> RIO (Resource a)
- System.IO.Resource.Linear: unsafeRelease :: Resource a %1 -> RIO ()
- Unsafe.Linear: class ToLinearN n f g
- Unsafe.Linear: coerce :: forall a b. a %1 -> b
- Unsafe.Linear: instance (Unsafe.Linear.ToLinearN' k fb gb, x GHC.Types.~~ (a -> fb), y GHC.Types.~~ (a -> gb)) => Unsafe.Linear.ToLinearN' ('Unsafe.Linear.S k) x y
- Unsafe.Linear: instance (Unsafe.Linear.ToLinearN' ni f g, ni GHC.Types.~ Unsafe.Linear.ToINat n) => Unsafe.Linear.ToLinearN n f g
- Unsafe.Linear: instance (a GHC.Types.~ b) => Unsafe.Linear.ToLinearN' 'Unsafe.Linear.Z a b
- Unsafe.Linear: toLinear :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) (a :: TYPE r1) (b :: TYPE r2) p x. (a %p -> b) %1 -> a %x -> b
- Unsafe.Linear: toLinear2 :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) (r3 :: RuntimeRep) (a :: TYPE r1) (b :: TYPE r2) (c :: TYPE r3) p q x y. (a %p -> b %q -> c) %1 -> a %x -> b %y -> c
- Unsafe.Linear: 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 x y z. (a %p -> b %q -> c %r -> d) %1 -> a %x -> b %y -> c %z -> d
- Unsafe.Linear: toLinearN :: forall n f g. ToLinearN n f g => f %1 -> g
- Unsafe.Linear: unsafeLinearityProofN :: ToLinearN n f g => UnsafeEquality f g
+ Foreign.Heap: Empty :: Heap k a
+ Foreign.Heap: Heap :: k -> a -> Box (List (NEHeap k a)) -> NEHeap k a
+ Foreign.Heap: NonEmpty :: Box (NEHeap k a) -> Heap k a
+ Foreign.Heap: data Heap k a
+ Foreign.Heap: data NEHeap k a
+ Foreign.Heap: empty :: Heap k a
+ Foreign.Heap: extractMin :: (Representable k, Representable a, Movable k, Ord k) => Heap k a %1 -> Pool %1 -> Maybe (k, a, Heap k a)
+ Foreign.Heap: extractMinN :: (Representable k, Representable a, Movable k, Ord k) => NEHeap k a %1 -> Pool %1 -> (k, a, Heap k a)
+ Foreign.Heap: foldl :: forall k a b. (Representable k, Representable a, Movable k, Ord k) => (b %1 -> k %1 -> a %1 -> b) -> b %1 -> Heap k a %1 -> Pool %1 -> b
+ Foreign.Heap: instance (Foreign.Marshal.Pure.Internal.Representable k, Foreign.Marshal.Pure.Internal.Representable a) => Foreign.Marshal.Pure.Internal.MkRepresentable (Foreign.Heap.NEHeap k a) (k, a, Foreign.Marshal.Pure.Internal.Box (Foreign.List.List (Foreign.Heap.NEHeap k a)))
+ Foreign.Heap: instance (Foreign.Marshal.Pure.Internal.Representable k, Foreign.Marshal.Pure.Internal.Representable a) => Foreign.Marshal.Pure.Internal.Representable (Foreign.Heap.NEHeap k a)
+ Foreign.Heap: merge :: forall k a. (Representable k, Representable a, Movable k, Ord k) => Heap k a %1 -> Heap k a %1 -> Pool %1 -> Heap k a
+ Foreign.Heap: mergeN :: forall k a. (Representable k, Representable a, Movable k, Ord k) => NEHeap k a %1 -> NEHeap k a %1 -> Pool %1 -> NEHeap k a
+ Foreign.Heap: mergeN' :: forall k a. (Representable k, Representable a, Movable k, Ord k) => NEHeap k a %1 -> Heap k a %1 -> Pool %1 -> NEHeap k a
+ Foreign.Heap: ofList :: (Representable k, Representable a, Movable k, Ord k) => [(k, a)] -> Pool %1 -> Heap k a
+ Foreign.Heap: pairUp :: forall k a. (Representable k, Representable a, Movable k, Ord k) => List (NEHeap k a) %1 -> Pool %1 -> Heap k a
+ Foreign.Heap: singleton :: forall k a. (Representable k, Representable a) => k %1 -> a %1 -> Pool %1 -> Heap k a
+ Foreign.Heap: singletonN :: (Representable k, Representable a) => k %1 -> a %1 -> Pool %1 -> NEHeap k a
+ Foreign.Heap: sort :: forall k a. (Representable k, Representable a, Movable k, Ord k, Movable a) => [(k, a)] -> [(k, a)]
+ Foreign.Heap: toList :: (Representable k, Representable a, Movable k, Ord k) => Heap k a %1 -> Pool %1 -> [(k, a)]
+ Foreign.Heap: unfold :: forall k a s. (Representable k, Representable a, Movable k, Ord k) => (s -> Maybe ((k, a), s)) -> s -> Pool %1 -> Heap k a
+ Foreign.List: Cons :: !a -> !Box (List a) -> List a
+ Foreign.List: Nil :: List a
+ Foreign.List: data List a
+ Foreign.List: foldl :: forall a b. Representable a => (b %1 -> a %1 -> b) -> b %1 -> List a %1 -> b
+ Foreign.List: foldr :: forall a b. Representable a => (a %1 -> b %1 -> b) -> b %1 -> List a %1 -> b
+ Foreign.List: instance Foreign.Marshal.Pure.Internal.Representable a => Foreign.Marshal.Pure.Internal.MkRepresentable (Foreign.List.List a) (GHC.Maybe.Maybe (a, Foreign.Marshal.Pure.Internal.Box (Foreign.List.List a)))
+ Foreign.List: instance Foreign.Marshal.Pure.Internal.Representable a => Foreign.Marshal.Pure.Internal.Representable (Foreign.List.List a)
+ Foreign.List: map :: forall a b. (Representable a, Representable b) => (a %1 -> b) -> List a %1 -> Pool %1 -> List b
+ Foreign.List: ofList :: Representable a => [a] -> Pool %1 -> List a
+ Foreign.List: ofRList :: Representable a => [a] -> Pool %1 -> List a
+ Foreign.List: runfold :: forall a s. Representable a => (s -> Maybe (a, s)) -> s -> Pool %1 -> List a
+ Foreign.List: toList :: Representable a => List a %1 -> [a]
+ Foreign.List: unfold :: forall a s. Representable a => (s -> Maybe (a, s)) -> s -> Pool %1 -> List a
+ Foreign.List: unfoldL :: forall a s. Representable a => (s %1 -> Maybe (a, s)) -> s %1 -> Pool %1 -> List a
+ Simple.FileIO: (>>#=) :: RIO a %1 -> (a %1 -> RIO b) %1 -> RIO b
+ Simple.FileIO: (>>==) :: RIO () %1 -> (() -> RIO b) %1 -> RIO b
+ Simple.FileIO: getFirstLineExplicit :: FilePath -> RIO (Ur Text)
+ Simple.FileIO: infixl 1 >>==
+ Simple.FileIO: inject :: a %1 -> RIO a
+ Simple.FileIO: linearGetFirstLine :: FilePath -> RIO (Ur Text)
+ Simple.FileIO: linearPrintFirstLine :: FilePath -> IO ()
+ Simple.FileIO: printFirstLine :: FilePath -> IO ()
+ Simple.FileIO: printFirstLineAfterClose :: FilePath -> IO ()
+ Simple.FileIO: printFirstLineExplicit :: FilePath -> IO ()
+ Simple.FileIO: printFirstLineNoClose :: FilePath -> IO ()
+ Simple.FileIO: type LinHandle = Handle
+ Simple.FileIO: type RIO = RIO
+ Simple.Pure: (#.) :: (b %1 -> c) -> (a %1 -> b) -> a %1 -> c
+ Simple.Pure: [ForcedUnlinear] :: a -> ForcedUnlinear a
+ Simple.Pure: [LinearHolder2] :: a -> b -> LinearHolder2
+ Simple.Pure: [LinearHolder] :: a -> LinearHolder a
+ Simple.Pure: data ForcedUnlinear a
+ Simple.Pure: data LinearHolder a
+ Simple.Pure: data LinearHolder2
+ Simple.Pure: demote :: (ForcedUnlinear a %1 -> b) -> a -> b
+ Simple.Pure: forcedLinearPair :: ForcedUnlinear a %1 -> (a, a)
+ Simple.Pure: infixr 9 #.
+ Simple.Pure: linearCompose :: (a, a) %1 -> (a, a)
+ Simple.Pure: linearHold :: a %1 -> LinearHolder a
+ Simple.Pure: linearHold' :: a %1 -> LinearHolder2
+ Simple.Pure: linearHoldExtract :: LinearHolder a %1 -> a
+ Simple.Pure: linearIdentity :: a %1 -> a
+ Simple.Pure: linearIdentity2 :: a %1 -> a
+ Simple.Pure: linearIdentity3 :: a %1 -> a
+ Simple.Pure: linearPairIdentity :: (a, a) %1 -> (a, a)
+ Simple.Pure: linearSwap :: (a, a) %1 -> (a, a)
+ Simple.Pure: nonLinearPair :: a -> (a, a)
+ Simple.Pure: nonLinearPair2 :: a -> (a, a)
+ Simple.Pure: nonLinearSubsume :: (a, a) -> (a, a)
+ Simple.Pure: nonLinearTriple :: a -> (a, (a, a))
+ Simple.Pure: promote :: (a -> b) -> ForcedUnlinear a %1 -> b
+ Simple.Pure: regularIdentity :: a -> a
+ Simple.Quicksort: go :: Ord a => Int -> Int -> Array a %1 -> Array a
+ Simple.Quicksort: partition :: Ord a => Array a %1 -> a -> Int -> Int -> (Array a, Ur Int)
+ Simple.Quicksort: quicksortArray :: Ord a => Array a %1 -> Array a
+ Simple.Quicksort: quicksortUsingArray :: Ord a => [a] -> [a]
+ Simple.Quicksort: quicksortUsingList :: Ord a => [a] -> [a]
+ Simple.Quicksort: swap :: HasCallStack => Array a %1 -> Int -> Int -> Array a
+ Simple.TopSort: checkSource :: Node -> InDegGraph %1 -> (InDegGraph, Ur (Maybe Node))
+ Simple.TopSort: findSources :: [Node] -> InDegGraph %1 -> (InDegGraph, Ur [Node])
+ Simple.TopSort: mapAccum :: (a -> b %1 -> (b, Ur c)) -> [a] -> b %1 -> (b, Ur [c])
+ Simple.TopSort: pluckSources :: [Node] -> [Node] -> InDegGraph %1 -> Ur [Node]
+ Simple.TopSort: postOrderHM :: [Node] -> InDegGraph %1 -> Ur [Node]
+ Simple.TopSort: topsort :: [(Node, [Node])] -> [Node]
+ Simple.TopSort: type InDegGraph = HashMap Node ([Node], Int)
+ Simple.TopSort: type Node = Int
Files
- CHANGELOG.md +19/−0
- README.md +9/−1
- bench/Data/Mutable/HashMap.hs +1/−1
- bench/Data/Mutable/Quicksort.hs +40/−0
- bench/Main.hs +3/−1
- docs/USER_GUIDE.md +0/−33
- examples/Generic/Traverse.hs +0/−52
- examples/Main.hs +0/−18
- examples/Simple/Quicksort.hs +28/−17
- examples/Simple/TopSort.hs +8/−9
- examples/Test/Foreign.hs +0/−102
- examples/Test/Generic.hs +0/−11
- examples/Test/Quicksort.hs +0/−19
- linear-base.cabal +56/−44
- src/Control/Optics/Linear/Internal.hs +1/−1
- src/Control/Optics/Linear/Prism.hs +1/−1
- src/Data/Array/Mutable/Linear/Internal.hs +8/−8
- src/Data/Array/Mutable/Unlifted/Linear.hs +22/−3
- src/Data/Array/Polarized.hs +6/−8
- src/Data/Array/Polarized/Pull.hs +3/−2
- src/Data/Array/Polarized/Pull/Internal.hs +8/−3
- src/Data/Functor/Linear/Internal/Traversable.hs +1/−1
- src/Data/HashMap/Mutable/Linear/Internal.hs +10/−10
- src/Data/List/Linear.hs +8/−8
- src/Data/Monoid/Linear/Internal/Semigroup.hs +3/−3
- src/Data/Num/Linear.hs +127/−19
- src/Data/Ord/Linear/Internal/Ord.hs +1/−1
- src/Data/Replicator/Linear/Internal.hs +6/−6
- src/Data/Replicator/Linear/Internal/ReplicationStream.hs +4/−4
- src/Data/Set/Mutable/Linear/Internal.hs +3/−3
- src/Data/Unrestricted/Linear.hs +1/−1
- src/Data/Unrestricted/Linear/Internal/Instances.hs +34/−4
- src/Data/Unrestricted/Linear/Internal/Movable.hs +7/−7
- src/Data/V/Linear/Internal.hs +4/−4
- src/Data/Vector/Mutable/Linear/Internal.hs +7/−7
- src/Foreign/Marshal/Pure/Internal.hs +6/−6
- src/Streaming/Linear.hs +16/−16
- src/Streaming/Linear/Internal/Consume.hs +18/−18
- src/Streaming/Linear/Internal/Many.hs +13/−13
- src/Streaming/Linear/Internal/Process.hs +47/−47
- src/Streaming/Linear/Internal/Produce.hs +9/−9
- test-examples/Main.hs +16/−0
- test-examples/Test/Foreign.hs +102/−0
- test-examples/Test/Simple/Quicksort.hs +29/−0
- test/Main.hs +5/−1
- test/Test/Data/Functor/Linear.hs +59/−0
- test/Test/Data/List.hs +43/−0
- test/Test/Data/Mutable/Vector.hs +1/−1
- test/Test/Data/Polarized.hs +13/−1
- test/Test/Data/Replicator.hs +3/−3
- test/Test/Data/V.hs +4/−4
CHANGELOG.md view
@@ -1,5 +1,24 @@ # Change Log +## [v0.5.0](https://github.com/tweag/linear-base/tree/v0.5.0) (2025-04-07)++[Full Changelog](https://github.com/tweag/linear-base/compare/v0.4.0...v0.5.0)++### Headline changes++- Data.List.Linear.{take,drop} take one list element too many [\#484](https://github.com/tweag/linear-base/issues/484)+- Remove pull array index \(unsafe\), add uncons. [\#475](https://github.com/tweag/linear-base/pull/475) ([sjoerdvisscher](https://github.com/sjoerdvisscher))+- Adds missing Data.Num.Linear.\* instances for Word, Integer, Natural, Float, Word8/16/32/64 Int8/16/32/64 [\#467](https://github.com/tweag/linear-base/pull/467) ([Qqwy](https://github.com/Qqwy))+- In scope-passing style: use a `Movable b` instead of `Ur b` (it's fully backward compatible compatible)[\#473](https://github.com/tweag/linear-base/pull/473) ([aspiwack](https://github.com/aspiwack))++### Miscellaneous++- Clarify Ur documentation [\#476](https://github.com/tweag/linear-base/issues/476)+- Test with GHC 9.10 and GHC 9.12+ - 9.10 [\#479](https://github.com/tweag/linear-base/pull/479) ([tbagrel1](https://github.com/tbagrel1))+ - 9.12 [\#487](https://github.com/tweag/linear-base/pull/487) ([aspiwack](https://github.com/aspiwack))+- Improve wording about Ur [\#478](https://github.com/tweag/linear-base/pull/478) ([aspiwack](https://github.com/aspiwack))+ ## [v0.4.0](https://github.com/tweag/linear-base/tree/v0.4.0) (2023-10-13) [Full Changelog](https://github.com/tweag/linear-base/compare/v0.3.1...v0.4.0)
README.md view
@@ -1,9 +1,9 @@ # Linear base [](https://github.com/tweag/linear-base/blob/master/LICENSE)-[](https://buildkite.com/tweag-1/linear-base) [][hackage-pkg] [][stackage-pkg]+[][discord] Linear base is a standard library for developing applications with linear types. It is named `linear-base` to be an analog to the original [`base`]@@ -39,6 +39,10 @@ {-# LANGUAGE LinearTypes #-} ``` +To get in touch, you can join our+[][discord] server++ ## User Guide If you already know what `-XLinearTypes` does and what the linear@@ -85,6 +89,9 @@ To contribute please see the [Design Document] for instructions and advice on making pull requests. +A great first step is to join our+[][discord] server+ ## Licence See the [Licence file](https://github.com/tweag/linear-base/blob/master/LICENSE).@@ -97,3 +104,4 @@ [Design Document]: https://github.com/tweag/linear-base/blob/master/docs/DESIGN.md [hackage-pkg]: https://hackage.haskell.org/package/linear-base [stackage-pkg]: https://www.stackage.org/nightly/package/linear-base+[discord]: https://discord.com/invite/7yg5GxzvDJ
bench/Data/Mutable/HashMap.hs view
@@ -135,7 +135,7 @@ look :: LMap.HashMap Key Int %1 -> Key -> LMap.HashMap Key Int look hmap k =- LMap.lookup k hmap Linear.& \case+ case LMap.lookup k hmap of (Linear.Ur Nothing, hmap0) -> hmap0 (Linear.Ur (Just v), hmap0) -> Linear.seq (force v) hmap0
+ bench/Data/Mutable/Quicksort.hs view
@@ -0,0 +1,40 @@+{-# LANGUAGE NumericUnderscores #-}++module Data.Mutable.Quicksort (benchmarks) where++import Control.DeepSeq (force)+import Control.Exception (evaluate)+import Data.List (sort)+import Simple.Quicksort (quicksortUsingArray, quicksortUsingList)+import System.Random+import Test.Tasty.Bench++-- Follows thread from https://discourse.haskell.org/t/linear-haskell-quicksort-performance/10280++gen :: StdGen+gen = mkStdGen 4541645642++randomListBuilder :: Int -> IO [Int]+randomListBuilder size = evaluate $ force $ take size (randoms gen :: [Int])++sizes :: [Int]+sizes = [1_000, 50_000, 1_000_000]++benchmarks :: Benchmark+benchmarks =+ bgroup+ "quicksort"+ ( ( \size ->+ env (randomListBuilder size) $ \randomList ->+ bgroup+ ("size " ++ (show size))+ [ bench "quicksortUsingArray" $+ nf quicksortUsingArray randomList,+ bench "quicksortUsingList" $+ nf quicksortUsingList randomList,+ bench "sortStdLib" $+ nf sort randomList+ ]+ )+ <$> sizes+ )
bench/Main.hs view
@@ -2,11 +2,13 @@ import qualified Data.Mutable.Array as Array import qualified Data.Mutable.HashMap as HashMap+import qualified Data.Mutable.Quicksort as Quicksort import Test.Tasty.Bench (defaultMain) main :: IO () main = do defaultMain [ Array.benchmarks,- HashMap.benchmarks+ HashMap.benchmarks,+ Quicksort.benchmarks ]
docs/USER_GUIDE.md view
@@ -107,39 +107,6 @@ ## Temporary limitations -### Case statements are not linear--The following definition will **fail** to type check:--```haskell-maybeFlip :: Int %1-> Int %1-> (a,a) -> a-maybeFlip i j (x,y) = case i < j of- True -> x- False -> y-```--The scrutinee on (i.e., `x` in `case x of ...`) is considered to be-consumed many times. It's a limitation of the current implementation-of the type checker.--For now, we can mimic a linear case statement using the-`-XLambdaCase` language extension and the `(&)` from `Prelude.Linear`:--```haskell-{-# LANGUAGE LambdaCase #-}-import Prelude.Linear ((&))--maybeFlip :: Int %1-> Int %1-> (a,a) -> a-maybeFlip i j (x,y) = i < j & \case- True -> x- False -> y-```--The `(&)` operator is like `($)` with the argument order flipped.--This workaround will no longer be needed in GHC 9.2, where this limitation-has been lifted and `case` can be used in a linear context.- ### `let` and `where` bindings are not linear The following will **fail** to type check:
− examples/Generic/Traverse.hs
@@ -1,52 +0,0 @@-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE DeriveAnyClass #-}-{-# LANGUAGE DerivingVia #-}-{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE LinearTypes #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE StandaloneDeriving #-}-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE TypeApplications #-}-{-# LANGUAGE TypeFamilies #-}-{-# LANGUAGE NoImplicitPrelude #-}--module Generic.Traverse (genericTraverseTests) where--import Data.Functor.Linear (genericTraverse)-import qualified Data.Functor.Linear as Data-import Generics.Linear.TH-import Hedgehog-import Prelude.Linear-import Test.Tasty-import Test.Tasty.Hedgehog (testPropertyNamed)-import qualified Prelude--data Pair a = MkPair a a- deriving (Show, Prelude.Eq)--$(deriveGeneric1 ''Pair)--instance Data.Functor Pair where- fmap f (MkPair x y) = MkPair (f x) (f y)--instance Data.Traversable Pair where- traverse = genericTraverse--genericTraverseTests :: TestTree-genericTraverseTests =- testGroup- "genericTraverse examples"- [pairTest]--pairTest :: TestTree-pairTest =- testPropertyNamed "traverse via genericTraverse with WithLog and Pair" "propertyPairTest" propertyPairTest--propertyPairTest :: Property-propertyPairTest =- property $- ( Data.traverse- (\x -> (Sum (1 :: Int), 2 * x))- (MkPair 3 4 :: Pair Int)- )- === (Sum 2, (MkPair 6 8))
− examples/Main.hs
@@ -1,18 +0,0 @@-module Main where--import Test.Foreign (foreignGCTests)-import Test.Generic (genericTests)-import Test.Quicksort (quickSortTests)-import Test.Tasty--main :: IO ()-main = defaultMain allTests--allTests :: TestTree-allTests =- testGroup- "All tests"- [ foreignGCTests,- quickSortTests,- genericTests- ]
examples/Simple/Quicksort.hs view
@@ -1,8 +1,12 @@ {-# LANGUAGE LinearTypes #-} {-# LANGUAGE NoImplicitPrelude #-} +-- Uncomment the line below to observe the generated (optimised) Core. It will+-- land in a file named “Quicksort.dump-simpl”+-- {-# OPTIONS_GHC -ddump-simpl -ddump-to-file -dsuppress-all -dsuppress-uniques #-}+ -- | This module implements quicksort with mutable arrays from linear-base-module Simple.Quicksort (quickSort) where+module Simple.Quicksort where import Data.Array.Mutable.Linear (Array) import qualified Data.Array.Mutable.Linear as Array@@ -13,15 +17,22 @@ -- # Quicksort ------------------------------------------------------------------------------- -quickSort :: [Int] -> [Int]-quickSort xs = unur $ Array.fromList xs $ Array.toList . arrQuicksort+quicksortUsingList :: (Ord a) => [a] -> [a]+quicksortUsingList [] = []+quicksortUsingList (x : xs) = quicksortUsingList ltx ++ x : quicksortUsingList gex+ where+ ltx = [y | y <- xs, y < x]+ gex = [y | y <- xs, y >= x] -arrQuicksort :: Array Int %1 -> Array Int-arrQuicksort arr =+quicksortUsingArray :: (Ord a) => [a] -> [a]+quicksortUsingArray xs = unur $ Array.fromList xs $ Array.toList . quicksortArray++quicksortArray :: (Ord a) => Array a %1 -> Array a+quicksortArray arr = Array.size arr & \(Ur len, arr1) -> go 0 (len - 1) arr1 -go :: Int -> Int -> Array Int %1 -> Array Int+go :: (Ord a) => Int -> Int -> Array a %1 -> Array a go lo hi arr | lo >= hi = arr | otherwise =@@ -39,23 +50,23 @@ -- @arr'[j] > pivot@ for @ix < j <= hi@, -- @arr'[k] = arr[k]@ for @k < lo@ and @k > hi@, and -- @arr'@ is a permutation of @arr@.-partition :: Array Int %1 -> Int -> Int -> Int -> (Array Int, Ur Int)-partition arr pivot lx rx- | (rx < lx) = (arr, Ur (lx - 1))+partition :: (Ord a) => Array a %1 -> a -> Int -> Int -> (Array a, Ur Int)+partition arr pivot lo hi+ | (hi < lo) = (arr, Ur (lo - 1)) | otherwise =- Array.read arr lx+ Array.read arr lo & \(Ur lVal, arr1) ->- Array.read arr1 rx+ Array.read arr1 hi & \(Ur rVal, arr2) -> case (lVal <= pivot, pivot < rVal) of- (True, True) -> partition arr2 pivot (lx + 1) (rx - 1)- (True, False) -> partition arr2 pivot (lx + 1) rx- (False, True) -> partition arr2 pivot lx (rx - 1)+ (True, True) -> partition arr2 pivot (lo + 1) (hi - 1)+ (True, False) -> partition arr2 pivot (lo + 1) hi+ (False, True) -> partition arr2 pivot lo (hi - 1) (False, False) ->- swap arr2 lx rx- & \arr3 -> partition arr3 pivot (lx + 1) (rx - 1)+ swap arr2 lo hi+ & \arr3 -> partition arr3 pivot (lo + 1) (hi - 1) -- | @swap a i j@ exchanges the positions of values at @i@ and @j@ of @a@.-swap :: (HasCallStack) => Array Int %1 -> Int -> Int -> Array Int+swap :: (HasCallStack) => Array a %1 -> Int -> Int -> Array a swap arr i j = Array.read arr i & \(Ur ival, arr1) ->
examples/Simple/TopSort.hs view
@@ -13,7 +13,6 @@ import qualified Data.HashMap.Mutable.Linear as HMap import Data.Maybe.Linear (catMaybes) import Data.Unrestricted.Linear-import Prelude.Linear ((&)) import qualified Prelude.Linear as Linear -- # The topological sort of a DAG@@ -36,7 +35,7 @@ postOrderHM :: [Node] -> InDegGraph %1 -> Ur [Node] postOrderHM nodes dag =- findSources nodes (computeInDeg nodes dag) & \case+ case findSources nodes (computeInDeg nodes dag) of (dag, Ur sources) -> pluckSources sources [] dag where -- O(V + N)@@ -46,7 +45,7 @@ -- Increment in-degree of all neighbors incChildren :: InDegGraph %1 -> Ur Node %1 -> InDegGraph incChildren dag (Ur node) =- HMap.lookup node dag & \case+ case HMap.lookup node dag of (Ur Nothing, dag) -> dag (Ur (Just (xs, i)), dag) -> incNodes (move xs) dag where@@ -55,7 +54,7 @@ incNode :: InDegGraph %1 -> Ur Node %1 -> InDegGraph incNode dag (Ur node) =- HMap.lookup node dag & \case+ case HMap.lookup node dag of (Ur Nothing, dag') -> dag' (Ur (Just (n, d)), dag') -> HMap.insert node (n, d + 1) dag'@@ -66,10 +65,10 @@ pluckSources :: [Node] -> [Node] -> InDegGraph %1 -> Ur [Node] pluckSources [] postOrd dag = lseq dag (move postOrd) pluckSources (s : ss) postOrd dag =- HMap.lookup s dag & \case+ case HMap.lookup s dag of (Ur Nothing, dag) -> pluckSources ss (s : postOrd) dag (Ur (Just (xs, i)), dag) ->- walk xs dag & \case+ case walk xs dag of (dag', Ur newSrcs) -> pluckSources (newSrcs ++ ss) (s : postOrd) dag' where@@ -81,7 +80,7 @@ -- Decrement the degree of a node, save it if it is now a source decDegree :: Node -> InDegGraph %1 -> (InDegGraph, Ur (Maybe Node)) decDegree node dag =- HMap.lookup node dag & \case+ case HMap.lookup node dag of (Ur Nothing, dag') -> (dag', Ur Nothing) (Ur (Just (n, d)), dag') -> checkSource node (HMap.insert node (n, d - 1) dag')@@ -94,7 +93,7 @@ -- | Check if a node is a source, and if so return it checkSource :: Node -> InDegGraph %1 -> (InDegGraph, Ur (Maybe Node)) checkSource node dag =- HMap.lookup node dag & \case+ case HMap.lookup node dag of (Ur Nothing, dag) -> (dag, Ur Nothing) (Ur (Just (xs, 0)), dag) -> (dag, Ur (Just node)) (Ur (Just (xs, n)), dag) -> (dag, Ur Nothing)@@ -103,5 +102,5 @@ (a -> b %1 -> (b, Ur c)) -> [a] -> b %1 -> (b, Ur [c]) mapAccum f [] b = (b, Ur []) mapAccum f (x : xs) b =- mapAccum f xs b & \case+ case mapAccum f xs b of (b, Ur cs) -> second (Data.fmap (: cs)) (f x b)
− examples/Test/Foreign.hs
@@ -1,102 +0,0 @@-{-# LANGUAGE LinearTypes #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE RankNTypes #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE TypeApplications #-}-{-# LANGUAGE NoImplicitPrelude #-}--module Test.Foreign (foreignGCTests) where--import Control.Exception hiding (assert)-import Control.Monad (void)-import Data.Typeable-import qualified Foreign.Heap as Heap-import Foreign.List (List)-import qualified Foreign.List as List-import qualified Foreign.Marshal.Pure as Manual-import Hedgehog-import qualified Hedgehog.Gen as Gen-import qualified Hedgehog.Range as Range-import Prelude.Linear-import Test.Tasty-import Test.Tasty.Hedgehog (testPropertyNamed)-import qualified Prelude---- # Organizing tests----------------------------------------------------------------------------------foreignGCTests :: TestTree-foreignGCTests =- testGroup- "foreignGCTests"- [ listExampleTests,- heapExampleTests- ]--listExampleTests :: TestTree-listExampleTests =- testGroup- "list tests"- [ testPropertyNamed "List.toList . List.fromList = id" "invertNonGCList" invertNonGCList,- testPropertyNamed "map id = id" "mapIdNonGCList" mapIdNonGCList,- testPropertyNamed "memory freed post-exception" "testExceptionOnMem" testExceptionOnMem- ]--heapExampleTests :: TestTree-heapExampleTests =- testGroup- "heap tests"- [testPropertyNamed "sort = heapsort" "nonGCHeapSort" nonGCHeapSort]---- # Internal library----------------------------------------------------------------------------------list :: Gen [Int]-list = Gen.list (Range.linear 0 1000) (Gen.int (Range.linear 0 100))--eqList ::- forall a.- (Manual.Representable a, Movable a, Eq a) =>- List a %1 ->- List a %1 ->- Ur Bool-eqList l1 l2 = move $ (List.toList l1) == (List.toList l2)--data InjectedError = InjectedError- deriving (Typeable, Show)--instance Exception InjectedError---- # Properties----------------------------------------------------------------------------------invertNonGCList :: Property-invertNonGCList = property $ do- xs <- forAll list- let xs' =- unur $- Manual.withPool (\p -> move $ List.toList $ List.ofList xs p)- xs === xs'--mapIdNonGCList :: Property-mapIdNonGCList = property $ do- xs <- forAll list- let boolTest = unur $- Manual.withPool $ \p ->- dup3 p & \(p0, p1, p2) ->- eqList (List.ofList xs p0) (List.map id (List.ofList xs p1) p2)- assert boolTest--testExceptionOnMem :: Property-testExceptionOnMem = property $ do- xs <- forAll list- let bs = xs ++ (throw InjectedError)- let writeBadList = Manual.withPool (move . List.toList . List.ofRList bs)- let ignoreCatch = \_ -> Prelude.return ()- evalIO (catch @InjectedError (void (evaluate writeBadList)) ignoreCatch)--nonGCHeapSort :: Property-nonGCHeapSort = property $ do- xs <- forAll list- let ys :: [(Int, ())] = zip xs $ Prelude.replicate (Prelude.length xs) ()- (Heap.sort ys) === (reverse $ sort ys)
− examples/Test/Generic.hs
@@ -1,11 +0,0 @@-module Test.Generic (genericTests) where--import Generic.Traverse (genericTraverseTests)-import Test.Tasty--genericTests :: TestTree-genericTests =- testGroup- "Generic tests"- [ genericTraverseTests- ]
− examples/Test/Quicksort.hs
@@ -1,19 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--module Test.Quicksort (quickSortTests) where--import Data.List (sort)-import Hedgehog-import qualified Hedgehog.Gen as Gen-import qualified Hedgehog.Range as Range-import Simple.Quicksort (quickSort)-import Test.Tasty-import Test.Tasty.Hedgehog (testPropertyNamed)--quickSortTests :: TestTree-quickSortTests = testPropertyNamed "quicksort sorts" "testQuicksort" testQuicksort--testQuicksort :: Property-testQuicksort = property $ do- xs <- forAll $ Gen.list (Range.linear 0 1000) (Gen.int $ Range.linear 0 100)- sort xs === quickSort xs
linear-base.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: linear-base-version: 0.4.0+version: 0.5.0 license: MIT license-file: LICENSE copyright: (c) Tweag Holding and affiliates@@ -21,13 +21,26 @@ type: git location: https://github.com/tweag/linear-base -common warnings- ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wnoncanonical-monad-instances+common build-opts+ ghc-options: -O2 -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wnoncanonical-monad-instances -- Additional warnings we may consider adding: -- * -Wredundant-constraints : would need deactivating in the modules which use Nat+common rts-opts-multithread+ ghc-options: -threaded -rtsopts "-with-rtsopts=-N"+common rts-opts-monothread-stats+ ghc-options: -rtsopts "-with-rtsopts=-T" library- import: warnings+ import: build-opts+ hs-source-dirs: src+ if impl(ghc >= 9.4.0)+ hs-source-dirs: src-version-changes/ghc94/after+ else+ hs-source-dirs: src-version-changes/ghc94/before+ if impl(ghc >= 9.6.0)+ hs-source-dirs: src-version-changes/ghc96/after+ else+ hs-source-dirs: src-version-changes/ghc96/before exposed-modules: Control.Monad.IO.Class.Linear Control.Functor.Linear@@ -118,23 +131,12 @@ System.IO.Resource.Linear System.IO.Resource.Linear.Internal Unsafe.Linear-- hs-source-dirs: src- if impl(ghc >= 9.4.0)- hs-source-dirs: src-version-changes/ghc94/after- else- hs-source-dirs: src-version-changes/ghc94/before- if impl(ghc >= 9.6.0)- hs-source-dirs: src-version-changes/ghc96/after- else- hs-source-dirs: src-version-changes/ghc96/before- default-language: Haskell2010 build-depends:- base >=4.16 && <5, containers, ghc-prim,+ ghc-bignum, hashable, linear-generics >= 0.2, storable-tuple,@@ -143,23 +145,42 @@ vector >=0.12.2, primitive +library examples+ import: build-opts+ hs-source-dirs: examples+ exposed-modules:+ Foreign.List+ Foreign.Heap+ Simple.FileIO+ Simple.Pure+ Simple.Quicksort+ Simple.TopSort+ build-depends:+ base,+ linear-base,+ storable-tuple,+ vector,+ text+ default-language: Haskell2010+ test-suite test- import: warnings+ import: build-opts+ import: rts-opts-multithread type: exitcode-stdio-1.0 main-is: Main.hs hs-source-dirs: test other-modules: Test.Data.Destination+ Test.Data.Functor.Linear+ Test.Data.List Test.Data.Mutable.Array- Test.Data.Mutable.Vector Test.Data.Mutable.HashMap Test.Data.Mutable.Set+ Test.Data.Mutable.Vector Test.Data.Polarized- Test.Data.V Test.Data.Replicator-+ Test.Data.V default-language: Haskell2010- ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends: inspection-testing, tasty-inspection-testing,@@ -170,47 +191,37 @@ tasty, tasty-hedgehog >= 1.2, mmorph,- vector+ vector,+ linear-generics -test-suite examples- import: warnings+test-suite test-examples+ import: build-opts+ import: rts-opts-multithread type: exitcode-stdio-1.0 main-is: Main.hs- hs-source-dirs: examples+ hs-source-dirs: test-examples other-modules: Test.Foreign- Test.Quicksort- Test.Generic- Foreign.List- Foreign.Heap- Simple.FileIO- Simple.Pure- Simple.Quicksort- Simple.TopSort- Generic.Traverse-+ Test.Simple.Quicksort default-language: Haskell2010- ghc-options: -threaded -rtsopts -with-rtsopts=-N build-depends: base, linear-base, tasty, tasty-hedgehog, hedgehog,- storable-tuple,- vector,- text,- linear-generics+ examples -benchmark mutable-data- import: warnings+benchmark bench+ import: build-opts+ import: rts-opts-monothread-stats type: exitcode-stdio-1.0 main-is: Main.hs hs-source-dirs: bench other-modules: Data.Mutable.HashMap Data.Mutable.Array-+ Data.Mutable.Quicksort default-language: Haskell2010 build-depends: base,@@ -224,4 +235,5 @@ random-shuffle, tasty-bench >= 0.3, unordered-containers,- MonadRandom+ MonadRandom,+ examples
src/Control/Optics/Linear/Internal.hs view
@@ -173,7 +173,7 @@ lengthOf :: (MultIdentity r) => Optic_ (NonLinear.Kleisli (Const (Sum r))) s t a b -> s -> r lengthOf l s =- (gets l (const (Sum one)) s) & \case+ case gets l (const (Sum one)) s of Sum r -> r -- XXX: the below two functions will be made redundant with multiplicity
src/Control/Optics/Linear/Prism.hs view
@@ -23,7 +23,7 @@ -- -- (This is a bit of a toy example since we could use @over@ for this.) -- formatLicenceName :: PersonId %1-> PersonId -- formatLicenceName personId =--- Data.fmap modLisc (match pIdLiscPrism personId) & \case+-- case Data.fmap modLisc (match pIdLiscPrism personId) of -- Left personId' -> personId' -- Right lisc -> build pIdLiscPrism lisc -- where
src/Data/Array/Mutable/Linear/Internal.hs view
@@ -62,11 +62,11 @@ -- | Allocate a constant array given a size and an initial value -- The size must be non-negative, otherwise this errors. alloc ::- (HasCallStack) =>+ (HasCallStack, Movable b) => Int -> a ->- (Array a %1 -> Ur b) %1 ->- Ur b+ (Array a %1 -> b) %1 ->+ b alloc s x f | s < 0 = (error ("Array.alloc: negative size: " ++ show s) :: x %1 -> x)@@ -89,11 +89,11 @@ -- | Allocate an array from a list fromList ::- (HasCallStack) =>+ (HasCallStack, Movable b) => [a] ->- (Array a %1 -> Ur b) %1 ->- Ur b-fromList list (f :: Array a %1 -> Ur b) =+ (Array a %1 -> b) %1 ->+ b+fromList list (f :: Array a %1 -> b) = alloc (Prelude.length list) (error "invariant violation: unintialized array position")@@ -190,7 +190,7 @@ Array a %1 -> (Array a, Array a) slice from targetSize arr =- size arr & \case+ case size arr of (Ur s, Array old) | s < from + targetSize -> Unlifted.lseq
src/Data/Array/Mutable/Unlifted/Linear.hs view
@@ -60,13 +60,32 @@ -- | Allocate a mutable array of given size using a default value. -- -- The size should be non-negative.-alloc :: Int -> a -> (Array# a %1 -> Ur b) %1 -> Ur b-alloc (GHC.I# s) a f =+alloc :: (Movable b) => Int -> a -> (Array# a %1 -> b) %1 -> b+alloc i a f = case move (unsafe_alloc i a f) of+ Ur b -> b+{-# INLINEABLE alloc #-}++-- The `alloc` function is split in two. One very unsafe below (it's very+-- unsafe, because `unafe_alloc 57 0 id` returns an unrestricted _mutable_+-- `Array#` breaking the module's invariants). Because `unsafe_alloc` calls+-- `runRW#`, it's marked as `NOINLINE`.+--+-- It's made safe by the wrapping function `alloc`, which restricts `b` to be+-- `Movable` (`Array#` is crucially not `Movable`, therefore `alloc 57 0 id`+-- doesn't type). Furthermore, `alloc` cases on `move` to make sure that all the+-- effects have been run by the time we evaluate the result of an `alloc`. It's+-- fine that `alloc` is inlined: its semantics is preserved by program+-- transformations. It's useful that `alloc` be inlined, because in most+-- instance `case move … of` will trigger a case-of-known-constructor avoiding+-- an extra allocation. This is in particular the case for the common case where+-- `b = Ur x`.+unsafe_alloc :: Int -> a -> (Array# a %1 -> b) %1 -> b+unsafe_alloc (GHC.I# s) a f = let new = GHC.runRW# Prelude.$ \st -> case GHC.newArray# s a st of (# _, arr #) -> Array# arr in f new-{-# NOINLINE alloc #-} -- prevents runRW# from floating outwards+{-# NOINLINE unsafe_alloc #-} -- prevents runRW# from floating outwards -- For the reasoning behind these NOINLINE pragmas, see the discussion at: -- https://github.com/tweag/linear-base/pull/187#pullrequestreview-489183531
src/Data/Array/Polarized.hs view
@@ -55,14 +55,12 @@ -- vecfilter vec f = Push.alloc (transfer (loop (Pull.fromVector vec) f)) -- where -- loop :: Pull.Array a -> (a -> Bool) -> Pull.Array a--- loop arr f = case Pull.findLength arr of--- (0,_) -> Pull.fromFunction (error "empty") 0--- (n,_) -> case Pull.split 1 arr of--- (head, tail) -> case Pull.index head 0 of--- (a,_) ->--- if f a--- then Pull.append (Pull.singleton a) (loop tail f)--- else loop tail f+-- loop arr f = case Pull.uncons arr of+-- Nothing -> Pull.empty+-- Just (a, as) ->+-- if f a+-- then Pull.append (Pull.singleton a) (loop as f)+-- else loop as f -- @ -- --
src/Data/Array/Polarized/Pull.hs view
@@ -13,6 +13,7 @@ fromVector, make, singleton,+ empty, -- * Consumption toVector,@@ -27,7 +28,7 @@ findLength, split, reverse,- index,+ uncons, ) where @@ -45,7 +46,7 @@ import qualified Data.Functor.Linear as Data import Data.Vector (Vector) import qualified Data.Vector as Vector-import Prelude.Linear hiding (foldMap, foldr, reverse, zip, zipWith)+import Prelude.Linear hiding (foldMap, foldr, reverse, uncons, zip, zipWith) import qualified Unsafe.Linear as Unsafe -- | Convert a pull array into a list.
src/Data/Array/Polarized/Pull/Internal.hs view
@@ -37,6 +37,10 @@ -- is interesting in and of itself: I think this is like an n-ary With), and -- changing the other arrows makes no difference) +-- | Create an empty pull array+empty :: Array a+empty = fromFunction (\_ -> error "Data.Array.Polarized.Pull.Internal.empty: this should never be called") 0+ -- | Produce a pull array of lenght 1 consisting of solely the given element. singleton :: a %1 -> Array a singleton = Unsafe.toLinear (\x -> fromFunction (\_ -> x) 1)@@ -110,6 +114,7 @@ reverse :: Array a %1 -> Array a reverse (Array f n) = Array (\x -> f (n + 1 - x)) n --- | Index a pull array (without checking bounds)-index :: Array a %1 -> Int -> (a, Array a)-index (Array f n) ix = (f ix, Array f n)+-- | Decompose an array into its head and tail, returns @Nothing@ if the array is empty.+uncons :: Array a %1 -> Maybe (a, Array a)+uncons (Array _ 0) = Nothing+uncons (Array f n) = Just (f 0, fromFunction (\x -> f (x + 1)) (n - 1))
src/Data/Functor/Linear/Internal/Traversable.hs view
@@ -239,7 +239,7 @@ {-# INLINE gtraverse #-} instance GTraversable V1 where- gtraverse _ v = Control.pure ((\case {}) v)+ gtraverse _ v = Control.pure (case v of {}) instance GTraversable UAddr where gtraverse _ (UAddr x) = Control.pure (UAddr x)
src/Data/HashMap/Mutable/Linear/Internal.hs view
@@ -133,10 +133,10 @@ -- | Run a computation with an empty 'HashMap' with given capacity. empty :: forall k v b.- (Keyed k) =>+ (Keyed k, Movable b) => Int ->- (HashMap k v %1 -> Ur b) %1 ->- Ur b+ (HashMap k v %1 -> b) %1 ->+ b empty size scope = let cap = max 1 size in Array.alloc cap Nothing (\arr -> scope (HashMap 0 cap arr))@@ -151,10 +151,10 @@ -- | Run a computation with an 'HashMap' containing given key-value pairs. fromList :: forall k v b.- (Keyed k) =>+ (Keyed k, Movable b) => [(k, v)] ->- (HashMap k v %1 -> Ur b) %1 ->- Ur b+ (HashMap k v %1 -> b) %1 ->+ b fromList xs scope = let cap = max@@ -295,7 +295,7 @@ then (Ur count, shiftSegmentBackward dec (end + 1) arr 0) else (Ur count, arr) | otherwise =- Array.unsafeRead arr ix & \case+ case Array.unsafeRead arr ix of (Ur Nothing, arr1) -> mapAndPushBack (ix + 1) end (False, 0) count arr1 (Ur (Just (RobinVal (PSL p) k v)), arr1) -> case f' k v of@@ -397,7 +397,7 @@ HashMap k c go _ hm (Ur []) acc = hm `lseq` acc go f hm (Ur ((k, b) : xs)) acc =- lookup k hm & \case+ case lookup k hm of (Ur Nothing, hm') -> go f hm' (Ur xs) acc (Ur (Just a), hm') -> go f hm' (Ur xs) (insert k (f a b) acc) @@ -446,7 +446,7 @@ -- | Check if the given key exists. member :: (Keyed k) => k -> HashMap k v %1 -> (Ur Bool, HashMap k v) member k hm =- lookup k hm & \case+ case lookup k hm of (Ur Nothing, hm') -> (Ur False, hm') (Ur (Just _), hm') -> (Ur True, hm') @@ -557,7 +557,7 @@ Int -> RobinArr k v shiftSegmentBackward dec s arr ix =- Array.unsafeRead arr ix & \case+ case Array.unsafeRead arr ix of (Ur Nothing, arr') -> arr' (Ur (Just (RobinVal 0 _ _)), arr') -> arr' (Ur (Just val), arr') ->
src/Data/List/Linear.hs view
@@ -117,7 +117,7 @@ filter :: (Dupable a) => (a %1 -> Bool) -> [a] %1 -> [a] filter _ [] = [] filter p (x : xs) =- dup x & \case+ case dup x of (x', x'') -> if p x' then x'' : filter p xs@@ -149,10 +149,10 @@ span :: (Dupable a) => (a %1 -> Bool) -> [a] %1 -> ([a], [a]) span _ [] = ([], []) span f (x : xs) =- dup x & \case+ case dup x of (x', x'') -> if f x'- then span f xs & \case (ts, fs) -> (x'' : ts, fs)+ then case span f xs of (ts, fs) -> (x'' : ts, fs) else ([x''], xs) -- The partition function takes a predicate a list and returns the@@ -191,13 +191,13 @@ take :: (Consumable a) => Int -> [a] %1 -> [a] take _ [] = [] take i (x : xs)- | i Prelude.< 0 = (x, xs) `lseq` []+ | i Prelude.<= 0 = (x, xs) `lseq` [] | otherwise = x : take (i - 1) xs drop :: (Consumable a) => Int -> [a] %1 -> [a] drop _ [] = [] drop i (x : xs)- | i Prelude.< 0 = x : xs+ | i Prelude.<= 0 = x : xs | otherwise = x `lseq` drop (i - 1) xs -- | The intersperse function takes an element and a list and@@ -310,7 +310,7 @@ scanr :: (Dupable b) => (a %1 -> b %1 -> b) -> b %1 -> [a] %1 -> [b] scanr _ b [] = [b] scanr f b (a : as) =- scanr f b as & \case+ case scanr f b as of (b' : bs') -> dup2 b' & \(b'', b''') -> f a b'' : b''' : bs'@@ -322,7 +322,7 @@ scanr1 _ [] = [] scanr1 _ [a] = [a] scanr1 f (a : as) =- scanr1 f as & \case+ case scanr1 f as of (a' : as') -> dup2 a' & \(a'', a''') -> f a a'' : a''' : as'@@ -364,7 +364,7 @@ zipWith' _ (a : as) [] = ([], Just (Left (a :| as))) zipWith' _ [] (b : bs) = ([], Just (Right (b :| bs))) zipWith' f (a : as) (b : bs) =- zipWith' f as bs & \case+ case zipWith' f as bs of (cs, rest) -> (f a b : cs, rest) zipWith3 :: forall a b c d. (Consumable a, Consumable b, Consumable c) => (a %1 -> b %1 -> c %1 -> d) -> [a] %1 -> [b] %1 -> [c] %1 -> [d]
src/Data/Monoid/Linear/Internal/Semigroup.hs view
@@ -126,14 +126,14 @@ instance (Consumable a) => Semigroup (Monoid.First a) where (Monoid.First Nothing) <> y = y x <> (Monoid.First y) =- y & \case+ case y of Nothing -> x Just y' -> y' `lseq` x instance (Consumable a) => Semigroup (Monoid.Last a) where x <> (Monoid.Last Nothing) = x (Monoid.Last x) <> y =- x & \case+ case x of Nothing -> y Just x' -> x' `lseq` y @@ -174,7 +174,7 @@ instance (Consumable a, Consumable b) => Semigroup (Either a b) where Left x <> y = x `lseq` y x <> y =- y & \case+ case y of Left y' -> y' `lseq` x Right y' -> y' `lseq` x
src/Data/Num/Linear.hs view
@@ -42,8 +42,11 @@ -- TODO: flesh out laws +import qualified Data.Int import Data.Monoid.Linear import Data.Unrestricted.Linear+import qualified Data.Word+import GHC.Num.Natural (Natural) import qualified Unsafe.Linear as Unsafe import qualified Prelude @@ -208,38 +211,143 @@ instance (AddIdentity a) => Monoid (Sum a) where mempty = Sum zero +{- ORMOLU_DISABLE -} deriving via MovableNum Prelude.Int instance Additive Prelude.Int--deriving via MovableNum Prelude.Double instance Additive Prelude.Double- deriving via MovableNum Prelude.Int instance AddIdentity Prelude.Int--deriving via MovableNum Prelude.Double instance AddIdentity Prelude.Double- deriving via MovableNum Prelude.Int instance AdditiveGroup Prelude.Int--deriving via MovableNum Prelude.Double instance AdditiveGroup Prelude.Double- deriving via MovableNum Prelude.Int instance Multiplicative Prelude.Int+deriving via MovableNum Prelude.Int instance MultIdentity Prelude.Int+deriving via MovableNum Prelude.Int instance Semiring Prelude.Int+deriving via MovableNum Prelude.Int instance Ring Prelude.Int+deriving via MovableNum Prelude.Int instance FromInteger Prelude.Int+deriving via MovableNum Prelude.Int instance Num Prelude.Int +deriving via MovableNum Prelude.Word instance Additive Prelude.Word+deriving via MovableNum Prelude.Word instance AddIdentity Prelude.Word+deriving via MovableNum Prelude.Word instance AdditiveGroup Prelude.Word+deriving via MovableNum Prelude.Word instance Multiplicative Prelude.Word+deriving via MovableNum Prelude.Word instance MultIdentity Prelude.Word+deriving via MovableNum Prelude.Word instance Semiring Prelude.Word+deriving via MovableNum Prelude.Word instance Ring Prelude.Word+deriving via MovableNum Prelude.Word instance FromInteger Prelude.Word+deriving via MovableNum Prelude.Word instance Num Prelude.Word++deriving via MovableNum Prelude.Double instance Additive Prelude.Double+deriving via MovableNum Prelude.Double instance AddIdentity Prelude.Double+deriving via MovableNum Prelude.Double instance AdditiveGroup Prelude.Double deriving via MovableNum Prelude.Double instance Multiplicative Prelude.Double+deriving via MovableNum Prelude.Double instance MultIdentity Prelude.Double+deriving via MovableNum Prelude.Double instance Semiring Prelude.Double+deriving via MovableNum Prelude.Double instance Ring Prelude.Double+deriving via MovableNum Prelude.Double instance FromInteger Prelude.Double+deriving via MovableNum Prelude.Double instance Num Prelude.Double -deriving via MovableNum Prelude.Int instance MultIdentity Prelude.Int+deriving via MovableNum Prelude.Float instance Additive Prelude.Float+deriving via MovableNum Prelude.Float instance AddIdentity Prelude.Float+deriving via MovableNum Prelude.Float instance AdditiveGroup Prelude.Float+deriving via MovableNum Prelude.Float instance Multiplicative Prelude.Float+deriving via MovableNum Prelude.Float instance MultIdentity Prelude.Float+deriving via MovableNum Prelude.Float instance Semiring Prelude.Float+deriving via MovableNum Prelude.Float instance Ring Prelude.Float+deriving via MovableNum Prelude.Float instance FromInteger Prelude.Float+deriving via MovableNum Prelude.Float instance Num Prelude.Float -deriving via MovableNum Prelude.Double instance MultIdentity Prelude.Double+deriving via MovableNum Prelude.Integer instance Additive Prelude.Integer+deriving via MovableNum Prelude.Integer instance AddIdentity Prelude.Integer+deriving via MovableNum Prelude.Integer instance AdditiveGroup Prelude.Integer+deriving via MovableNum Prelude.Integer instance Multiplicative Prelude.Integer+deriving via MovableNum Prelude.Integer instance MultIdentity Prelude.Integer+deriving via MovableNum Prelude.Integer instance Semiring Prelude.Integer+deriving via MovableNum Prelude.Integer instance Ring Prelude.Integer+deriving via MovableNum Prelude.Integer instance FromInteger Prelude.Integer+deriving via MovableNum Prelude.Integer instance Num Prelude.Integer -deriving via MovableNum Prelude.Int instance Semiring Prelude.Int+deriving via MovableNum Natural instance Additive Natural+deriving via MovableNum Natural instance AddIdentity Natural+deriving via MovableNum Natural instance AdditiveGroup Natural+deriving via MovableNum Natural instance Multiplicative Natural+deriving via MovableNum Natural instance MultIdentity Natural+deriving via MovableNum Natural instance Semiring Natural+-- NOTE: Natural is not a Ring; no element but 0 has an additive inverse.+deriving via MovableNum Natural instance FromInteger Natural -deriving via MovableNum Prelude.Double instance Semiring Prelude.Double+deriving via MovableNum Data.Int.Int8 instance Additive Data.Int.Int8+deriving via MovableNum Data.Int.Int8 instance AddIdentity Data.Int.Int8+deriving via MovableNum Data.Int.Int8 instance AdditiveGroup Data.Int.Int8+deriving via MovableNum Data.Int.Int8 instance Multiplicative Data.Int.Int8+deriving via MovableNum Data.Int.Int8 instance MultIdentity Data.Int.Int8+deriving via MovableNum Data.Int.Int8 instance Semiring Data.Int.Int8+deriving via MovableNum Data.Int.Int8 instance Ring Data.Int.Int8+deriving via MovableNum Data.Int.Int8 instance FromInteger Data.Int.Int8+deriving via MovableNum Data.Int.Int8 instance Num Data.Int.Int8 -deriving via MovableNum Prelude.Int instance Ring Prelude.Int+deriving via MovableNum Data.Int.Int16 instance Additive Data.Int.Int16+deriving via MovableNum Data.Int.Int16 instance AddIdentity Data.Int.Int16+deriving via MovableNum Data.Int.Int16 instance AdditiveGroup Data.Int.Int16+deriving via MovableNum Data.Int.Int16 instance Multiplicative Data.Int.Int16+deriving via MovableNum Data.Int.Int16 instance MultIdentity Data.Int.Int16+deriving via MovableNum Data.Int.Int16 instance Semiring Data.Int.Int16+deriving via MovableNum Data.Int.Int16 instance Ring Data.Int.Int16+deriving via MovableNum Data.Int.Int16 instance FromInteger Data.Int.Int16+deriving via MovableNum Data.Int.Int16 instance Num Data.Int.Int16 -deriving via MovableNum Prelude.Double instance Ring Prelude.Double+deriving via MovableNum Data.Int.Int32 instance Additive Data.Int.Int32+deriving via MovableNum Data.Int.Int32 instance AddIdentity Data.Int.Int32+deriving via MovableNum Data.Int.Int32 instance AdditiveGroup Data.Int.Int32+deriving via MovableNum Data.Int.Int32 instance Multiplicative Data.Int.Int32+deriving via MovableNum Data.Int.Int32 instance MultIdentity Data.Int.Int32+deriving via MovableNum Data.Int.Int32 instance Semiring Data.Int.Int32+deriving via MovableNum Data.Int.Int32 instance Ring Data.Int.Int32+deriving via MovableNum Data.Int.Int32 instance FromInteger Data.Int.Int32+deriving via MovableNum Data.Int.Int32 instance Num Data.Int.Int32 -deriving via MovableNum Prelude.Int instance FromInteger Prelude.Int+deriving via MovableNum Data.Int.Int64 instance Additive Data.Int.Int64+deriving via MovableNum Data.Int.Int64 instance AddIdentity Data.Int.Int64+deriving via MovableNum Data.Int.Int64 instance AdditiveGroup Data.Int.Int64+deriving via MovableNum Data.Int.Int64 instance Multiplicative Data.Int.Int64+deriving via MovableNum Data.Int.Int64 instance MultIdentity Data.Int.Int64+deriving via MovableNum Data.Int.Int64 instance Semiring Data.Int.Int64+deriving via MovableNum Data.Int.Int64 instance Ring Data.Int.Int64+deriving via MovableNum Data.Int.Int64 instance FromInteger Data.Int.Int64+deriving via MovableNum Data.Int.Int64 instance Num Data.Int.Int64 -deriving via MovableNum Prelude.Double instance FromInteger Prelude.Double+deriving via MovableNum Data.Word.Word8 instance Additive Data.Word.Word8+deriving via MovableNum Data.Word.Word8 instance AddIdentity Data.Word.Word8+deriving via MovableNum Data.Word.Word8 instance AdditiveGroup Data.Word.Word8+deriving via MovableNum Data.Word.Word8 instance Multiplicative Data.Word.Word8+deriving via MovableNum Data.Word.Word8 instance MultIdentity Data.Word.Word8+deriving via MovableNum Data.Word.Word8 instance Semiring Data.Word.Word8+deriving via MovableNum Data.Word.Word8 instance Ring Data.Word.Word8+deriving via MovableNum Data.Word.Word8 instance FromInteger Data.Word.Word8+deriving via MovableNum Data.Word.Word8 instance Num Data.Word.Word8 -deriving via MovableNum Prelude.Int instance Num Prelude.Int+deriving via MovableNum Data.Word.Word16 instance Additive Data.Word.Word16+deriving via MovableNum Data.Word.Word16 instance AddIdentity Data.Word.Word16+deriving via MovableNum Data.Word.Word16 instance AdditiveGroup Data.Word.Word16+deriving via MovableNum Data.Word.Word16 instance Multiplicative Data.Word.Word16+deriving via MovableNum Data.Word.Word16 instance MultIdentity Data.Word.Word16+deriving via MovableNum Data.Word.Word16 instance Semiring Data.Word.Word16+deriving via MovableNum Data.Word.Word16 instance Ring Data.Word.Word16+deriving via MovableNum Data.Word.Word16 instance FromInteger Data.Word.Word16+deriving via MovableNum Data.Word.Word16 instance Num Data.Word.Word16 -deriving via MovableNum Prelude.Double instance Num Prelude.Double+deriving via MovableNum Data.Word.Word32 instance Additive Data.Word.Word32+deriving via MovableNum Data.Word.Word32 instance AddIdentity Data.Word.Word32+deriving via MovableNum Data.Word.Word32 instance AdditiveGroup Data.Word.Word32+deriving via MovableNum Data.Word.Word32 instance Multiplicative Data.Word.Word32+deriving via MovableNum Data.Word.Word32 instance MultIdentity Data.Word.Word32+deriving via MovableNum Data.Word.Word32 instance Semiring Data.Word.Word32+deriving via MovableNum Data.Word.Word32 instance Ring Data.Word.Word32+deriving via MovableNum Data.Word.Word32 instance FromInteger Data.Word.Word32+deriving via MovableNum Data.Word.Word32 instance Num Data.Word.Word32++deriving via MovableNum Data.Word.Word64 instance Additive Data.Word.Word64+deriving via MovableNum Data.Word.Word64 instance AddIdentity Data.Word.Word64+deriving via MovableNum Data.Word.Word64 instance AdditiveGroup Data.Word.Word64+deriving via MovableNum Data.Word.Word64 instance Multiplicative Data.Word.Word64+deriving via MovableNum Data.Word.Word64 instance MultIdentity Data.Word.Word64+deriving via MovableNum Data.Word.Word64 instance Semiring Data.Word.Word64+deriving via MovableNum Data.Word.Word64 instance Ring Data.Word.Word64+deriving via MovableNum Data.Word.Word64 instance FromInteger Data.Word.Word64+deriving via MovableNum Data.Word.Word64 instance Num Data.Word.Word64+{- ORMOLU_ENABLE -}
src/Data/Ord/Linear/Internal/Ord.hs view
@@ -115,7 +115,7 @@ compare xs [] = xs `lseq` GT compare [] ys = ys `lseq` LT compare (x : xs) (y : ys) =- compare x y & \case+ case compare x y of EQ -> compare xs ys res -> (xs, ys) `lseq` res
src/Data/Replicator/Linear/Internal.hs view
@@ -89,7 +89,7 @@ next :: Replicator a %1 -> (a, Replicator a) next (Moved x) = (x, Moved x) next (Streamed (ReplicationStream s give dups consumes)) =- dups s & \case+ case dups s of (s1, s2) -> (give s1, Streamed (ReplicationStream s2 give dups consumes)) {-# INLINEABLE next #-} @@ -98,18 +98,18 @@ next# :: Replicator a %1 -> (# a, Replicator a #) next# (Moved x) = (# x, Moved x #) next# (Streamed (ReplicationStream s give dups consumes)) =- dups s & \case+ case dups s of (s1, s2) -> (# give s1, Streamed (ReplicationStream s2 give dups consumes) #) {-# INLINEABLE next# #-} -- | @'take' n as@ is a list of size @n@, containing @n@ replicas from @as@. take :: Prelude.Int -> Replicator a %1 -> [a] take 0 r =- consume r & \case+ case consume r of () -> [] take 1 r = [extract r] take n r =- next r & \case+ case next r of (a, r') -> a : take (n - 1) r' -- | Returns the next item from @'Replicator' a@ and efficiently consumes@@ -170,7 +170,7 @@ instance Elim 'Z a b where elim' b r =- consume r & \case+ case consume r of () -> b {-# INLINE elim' #-} @@ -180,6 +180,6 @@ instance (Elim ('S n) a b) => Elim ('S ('S n)) a b where elim' g r =- next r & \case+ case next r of (a, r') -> elim' @('S n) (g a) r' {-# INLINE elim' #-}
src/Data/Replicator/Linear/Internal/ReplicationStream.hs view
@@ -70,11 +70,11 @@ (sf, sx) (\(sf', sx') -> givef sf' (givex sx')) ( \(sf', sx') ->- (dupsf sf', dupsx sx') & \case+ case (dupsf sf', dupsx sx') of ((sf1, sf2), (sx1, sx2)) -> ((sf1, sx1), (sf2, sx2)) ) ( \(sf', sx') ->- consumesf sf' & \case+ case consumesf sf' of () -> consumesx sx' ) @@ -84,11 +84,11 @@ (sa, sb) (\(sa', sb') -> f (givea sa') (giveb sb')) ( \(sa', sb') ->- (dupsa sa', dupsb sb') & \case+ case (dupsa sa', dupsb sb') of ((sa1, sa2), (sb1, sb2)) -> ((sa1, sb1), (sa2, sb2)) ) ( \(sa', sb') ->- consumesa sa' & \case+ case consumesa sa' of () -> consumesb sb' ) -- We need to inline this to get good results with generic deriving
src/Data/Set/Mutable/Linear/Internal.hs view
@@ -29,8 +29,8 @@ -- # Constructors and Mutators ------------------------------------------------------------------------------- -empty :: (Keyed a) => Int -> (Set a %1 -> Ur b) %1 -> Ur b-empty s (f :: Set a %1 -> Ur b) =+empty :: (Keyed a, Movable b) => Int -> (Set a %1 -> b) %1 -> b+empty s (f :: Set a %1 -> b) = Linear.empty s (\hm -> f (Set hm)) toList :: (Keyed a) => Set a %1 -> Ur [a]@@ -63,7 +63,7 @@ member a (Set hm) = Linear.member a hm Linear.& \(b, hm') -> (b, Set hm') -fromList :: (Keyed a) => [a] -> (Set a %1 -> Ur b) %1 -> Ur b+fromList :: (Keyed a, Movable b) => [a] -> (Set a %1 -> b) %1 -> b fromList xs f = Linear.fromList (Prelude.map (,()) xs) (\hm -> f (Set hm))
src/Data/Unrestricted/Linear.hs view
@@ -4,7 +4,7 @@ -- = /Critical/ Definition: Restricted -- -- In a linear function @f :: a %1-> b@, the argument @a@ must--- be used in a linear way. Its use is __restricted__ while+-- be used in a linear way. Its use is __restricted__. By contrast, -- an argument in a non-linear function is __unrestricted__. -- -- Hence, a linear function with an argument of @Ur a@ (@Ur@ is short for
src/Data/Unrestricted/Linear/Internal/Instances.hs view
@@ -33,6 +33,8 @@ import qualified Data.V.Linear.Internal as V import qualified Data.Vector as Vector import GHC.Int+import GHC.Num.Integer (Integer (..))+import GHC.Num.Natural (Natural (..)) import GHC.TypeLits import GHC.Word import Prelude.Linear.Internal@@ -45,17 +47,17 @@ instance (Movable a) => Movable (AsMovable a) where move (AsMovable x) =- move x & \case+ case move x of Ur x' -> Ur (AsMovable x') instance (Movable a) => Consumable (AsMovable a) where consume x =- move x & \case+ case move x of Ur _ -> () instance (Movable a) => Dupable (AsMovable a) where dupR x =- move x & \case+ case move x of Ur x' -> Data.pure x' deriving via (AsMovable Int8) instance Consumable Int8@@ -146,6 +148,33 @@ -- copying an 'Word64#' and using it several times. /!\ move (W64# i) = Unsafe.toLinear (\j -> Ur (W64# j)) i +deriving via (AsMovable Integer) instance Consumable Integer++deriving via (AsMovable Integer) instance Dupable Integer++instance Movable Integer where+ -- /!\ 'Integer' is a sum type whose three possibilities each are strict wrappers of unboxed unlifed data types.+ -- (source: https://hackage.haskell.org/package/ghc-bignum-1.2/docs/GHC-Num-Integer.html#t:Integer)+ -- Therefore it cannot have any linear values hidden in a closure anywhere. Therefore it is safe to call+ -- non-linear functions linearly on this type: there is no difference between+ -- copying an 'Integer' and using it several times. /!\+ move (IS i) = Unsafe.toLinear (\j -> Ur (IS j)) i+ move (IP i) = Unsafe.toLinear (\j -> Ur (IP j)) i+ move (IN i) = Unsafe.toLinear (\j -> Ur (IN j)) i++deriving via (AsMovable Natural) instance Consumable Natural++deriving via (AsMovable Natural) instance Dupable Natural++instance Movable Natural where+ -- /!\ 'Natural' is a sum type whose two possibilities each are strict wrappers of unboxed unlifed data types.+ -- (source: https://hackage.haskell.org/package/ghc-bignum-1.2/docs/GHC-Num-Natural.html#t:Natural)+ -- Therefore it cannot have any linear values hidden in a closure anywhere. Therefore it is safe to call+ -- non-linear functions linearly on this type: there is no difference between+ -- copying an 'Integer' and using it several times. /!\+ move (NS i) = Unsafe.toLinear (\j -> Ur (NS j)) i+ move (NB i) = Unsafe.toLinear (\j -> Ur (NB j)) i+ -- TODO: instances for longer primitive tuples -- TODO: default instances based on the Generic framework @@ -157,7 +186,8 @@ instance (KnownNat n, Dupable a) => Dupable (V n a) where dupR (V xs) =- V . Unsafe.toLinear (Vector.fromListN (V.theLength @n))+ V+ . Unsafe.toLinear (Vector.fromListN (V.theLength @n)) Data.<$> dupR (Unsafe.toLinear Vector.toList xs) -- Some stock instances
src/Data/Unrestricted/Linear/Internal/Movable.hs view
@@ -172,15 +172,15 @@ gmove U1 = Ur U1 instance (GMovable f, GMovable g) => GMovable (f :+: g) where- gmove (L1 a) = gmove a & \case (Ur x) -> Ur (L1 x)- gmove (R1 a) = gmove a & \case (Ur x) -> Ur (R1 x)+ gmove (L1 a) = case gmove a of Ur x -> Ur (L1 x)+ gmove (R1 a) = case gmove a of Ur x -> Ur (R1 x) instance (GMovable f, GMovable g) => GMovable (f :*: g) where gmove (a :*: b) =- gmove a & \case- (Ur x) ->- gmove b & \case- (Ur y) -> Ur (x :*: y)+ case gmove a of+ Ur x ->+ case gmove b of+ Ur y -> Ur (x :*: y) instance (Movable c) => GMovable (K1 i c) where gmove (K1 c) = lcoerce (move c)@@ -192,7 +192,7 @@ gmove (MP1 x) = Ur (MP1 x) instance (GMovable f) => GMovable (MP1 'One f) where- gmove (MP1 a) = gmove a & \case Ur x -> Ur (MP1 x)+ gmove (MP1 a) = case gmove a of Ur x -> Ur (MP1 x) instance GMovable UChar where gmove (UChar c) = Unsafe.toLinear (\x -> Ur (UChar x)) c
src/Data/V/Linear/Internal.hs view
@@ -78,8 +78,8 @@ (<*>) :: V n (a %1 -> b) %1 -> V n a %1 -> V n b (V fs) <*> (V xs) =- V $- Unsafe.toLinear2 (Vector.zipWith (\f x -> f $ x)) fs xs+ V+ $ Unsafe.toLinear2 (Vector.zipWith (\f x -> f $ x)) fs xs infixl 4 <*> -- same fixity as base.<*> @@ -145,13 +145,13 @@ instance Elim 'Z a b where elim' b v =- consume v & \case+ case consume v of () -> b {-# INLINE elim' #-} instance (1 <= 1 + PeanoToNat n, (1 + PeanoToNat n) - 1 ~ PeanoToNat n, Elim n a b) => Elim ('S n) a b where elim' g v =- uncons v & \case+ case uncons v of (a, v') -> elim' @n (g a) v' {-# INLINE elim' #-}
src/Data/Vector/Mutable/Linear/Internal.hs view
@@ -56,17 +56,17 @@ & \(Ur size', arr') -> Vec size' arr' -- Allocate an empty vector-empty :: (Vector a %1 -> Ur b) %1 -> Ur b+empty :: (Movable b) => (Vector a %1 -> b) %1 -> b empty f = Array.fromList [] (f . fromArray) -- | Allocate a constant vector of a given non-negative size (and error on a -- bad size) constant ::- (HasCallStack) =>+ (HasCallStack, Movable b) => Int -> a ->- (Vector a %1 -> Ur b) %1 ->- Ur b+ (Vector a %1 -> b) %1 ->+ b constant size' x f | size' < 0 = (error ("Trying to construct a vector of size " ++ show size') :: x %1 -> x)@@ -74,7 +74,7 @@ | otherwise = Array.alloc size' x (f . fromArray) -- | Allocator from a list-fromList :: (HasCallStack) => [a] -> (Vector a %1 -> Ur b) %1 -> Ur b+fromList :: (HasCallStack, Movable b) => [a] -> (Vector a %1 -> b) %1 -> b fromList xs f = Array.fromList xs (f . fromArray) -- | Number of elements inside the vector.@@ -101,7 +101,7 @@ -- 'shrinkToFit' to remove the wasted space. pop :: Vector a %1 -> (Ur (Maybe a), Vector a) pop vec =- size vec & \case+ case size vec of (Ur 0, vec') -> (Ur Nothing, vec') (Ur s, vec') ->@@ -201,7 +201,7 @@ -- Otherwise, read an element, write if the predicate is true and advance -- the write cursor; otherwise keep the write cursor skipping the element. | otherwise =- unsafeGet r vec' & \case+ case unsafeGet r vec' of (Ur a, vec'') | Just b <- f a -> go (r + 1) (w + 1) s (unsafeSet w (Unsafe.coerce b) vec'')
src/Foreign/Marshal/Pure/Internal.hs view
@@ -29,10 +29,10 @@ import Foreign.Ptr import Foreign.Storable import Foreign.Storable.Tuple ()-import Prelude.Linear hiding (Eq (..), ($))+import Prelude.Linear hiding (Eq (..)) import System.IO.Unsafe import qualified Unsafe.Linear as Unsafe-import Prelude (Eq (..), return, ($), (<$>), (<*>), (=<<))+import Prelude (Eq (..), return, (<$>), (<*>), (=<<)) -- XXX: [2018-02-09] I'm having trouble with the `constraints` package (it seems -- that the version of Type.Reflection.Unsafe in the linear ghc compiler is not@@ -290,12 +290,12 @@ -- TODO: document individual functions -- | Given a linear computation that manages memory, run that computation.-withPool :: (Pool %1 -> Ur b) %1 -> Ur b-withPool scope = Unsafe.toLinear performScope scope+withPool :: forall b. (Movable b) => (Pool %1 -> b) %1 -> b+withPool scope = unur $ Unsafe.toLinear performScope scope where -- XXX: do ^ without `toLinear` by using linear IO - performScope :: (Pool %1 -> Ur b) -> Ur b+ performScope :: (Pool %1 -> b) -> Ur b performScope scope' = unsafeDupablePerformIO $ do -- Initialise the pool backPtr <- malloc@@ -303,7 +303,7 @@ start <- DLL nullPtr nullPtr <$> new end -- always at the start of the list poke backPtr start -- Run the computation- evaluate (scope' (Pool start))+ evaluate (move $ scope' (Pool start)) `finally` -- Clean up remaining variables. (freeAll start end)
src/Streaming/Linear.hs view
@@ -65,7 +65,7 @@ import Data.Functor.Sum import Data.Unrestricted.Linear import GHC.Stack-import Prelude.Linear (($), (&), (.))+import Prelude.Linear (($), (.)) import Streaming.Linear.Internal.Process (destroyExposed) import Streaming.Linear.Internal.Type import qualified Streaming.Prelude.Linear as Stream@@ -244,7 +244,7 @@ Stream f m r unfold' step state = Effect $ Control.do either <- step state- either & \case+ case either of Left r -> Control.return $ Return r Right (fs) -> Control.return $ Step $ Control.fmap (unfold step) fs {-# INLINEABLE unfold #-}@@ -261,7 +261,7 @@ loop :: Stream f m r loop = Effect $ Control.do maybeVal <- action- maybeVal & \case+ case maybeVal of Nothing -> Control.return $ Step $ Data.pure loop Just r -> Control.return $ Return r {-# INLINEABLE untilJust #-}@@ -344,7 +344,7 @@ where loop :: Stream f m r %1 -> Stream g m r loop stream =- stream & \case+ case stream of Return r -> Return r Step f -> Effect $ Control.fmap Step $ transform $ Control.fmap loop f Effect m -> Effect $ Control.fmap loop m@@ -461,10 +461,10 @@ loop :: Stream (Sum f g) m r %1 -> Stream (Sum (Stream f m) (Stream g m)) m r loop str = Control.do e <- Control.lift $ inspect str- e & \case+ case e of Left r -> Control.return r Right ostr ->- ostr & \case+ case ostr of InR gstr -> Step $ InR $ Control.fmap loop $ cleanR (Step (InR gstr)) InL fstr -> Step $ InL $ Control.fmap loop $ cleanL (Step (InL fstr)) @@ -474,7 +474,7 @@ go :: Stream (Sum f g) m r %1 -> Stream f m (Stream (Sum f g) m r) go s = Control.do e <- Control.lift $ inspect s- e & \case+ case e of Left r -> Control.return $ Control.return r Right (InL fstr) -> Step $ Control.fmap go fstr Right (InR gstr) -> Control.return $ Step (InR gstr)@@ -485,7 +485,7 @@ go :: Stream (Sum f g) m r %1 -> Stream g m (Stream (Sum f g) m r) go s = Control.do e <- Control.lift $ inspect s- e & \case+ case e of Left r -> Control.return $ Control.return r Right (InL fstr) -> Control.return $ Step (InL fstr) Right (InR gstr) -> Step $ Control.fmap go gstr@@ -509,7 +509,7 @@ where loop :: Stream f m r %1 -> m (Either r (f (Stream f m r))) loop stream =- stream & \case+ case stream of Return r -> Control.return (Left r) Effect m -> m Control.>>= loop Step fs -> Control.return (Right fs)@@ -552,7 +552,7 @@ LT -> Prelude.error "splitsAt called with negative index" $ stream EQ -> Return stream GT ->- stream & \case+ case stream of Return r -> Return $ Return r Effect m -> Effect $ Control.fmap (loop n) m Step f -> Step $ Control.fmap (loop (n - 1)) f@@ -587,7 +587,7 @@ where loop :: Stream (Stream f m) m r %1 -> Stream f m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop m Step f -> Control.do@@ -612,7 +612,7 @@ where go0 :: Stream (t m) m r %1 -> t m r go0 f =- f & \case+ case f of Return r -> Control.return r Effect m -> Control.lift m Control.>>= go0 Step fstr -> Control.do@@ -621,7 +621,7 @@ go1 :: Stream (t m) m r %1 -> t m r go1 f =- f & \case+ case f of Return r -> Control.return r Effect m -> Control.lift m Control.>>= go1 Step fstr -> Control.do@@ -736,7 +736,7 @@ where loop :: Stream (Compose m f) m r %1 -> Stream f m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop m Step (Compose mfs) -> Effect $ Control.do@@ -814,7 +814,7 @@ where loop :: (Control.Monad m) => Stream m m r %1 -> m r loop stream =- stream & \case+ case stream of Return r -> Control.return r Effect m -> m Control.>>= loop Step mrest -> mrest Control.>>= loop@@ -915,7 +915,7 @@ where loop :: Stream f m r %1 -> m b loop stream =- stream & \case+ case stream of Return r -> Control.return $ done r Effect m -> m Control.>>= loop Step f -> Control.return $ construct $ Control.fmap (theEffect . loop) f
src/Streaming/Linear/Internal/Consume.hs view
@@ -68,7 +68,7 @@ import qualified Data.Text as Text import qualified Data.Text.IO as Text import Data.Unrestricted.Linear-import Prelude.Linear (($), (&), (.))+import Prelude.Linear (($), (.)) import Streaming.Linear.Internal.Process import Streaming.Linear.Internal.Type import qualified System.IO as System@@ -112,7 +112,7 @@ where loop :: Stream (Of Text) IO r %1 -> IO r loop stream =- stream & \case+ case stream of Return r -> Control.return r Effect ms -> ms Control.>>= stdoutLn' Step (str :> stream) -> Control.do@@ -130,7 +130,7 @@ where loop :: Handle %1 -> Stream (Of Text) RIO r %1 -> RIO (r, Handle) loop handle stream =- stream & \case+ case stream of Return r -> Control.return (r, handle) Effect ms -> ms Control.>>= toHandle handle Step (text :> stream') -> Control.do@@ -170,7 +170,7 @@ where loop :: Stream (Of a) m r %1 -> m r loop stream =- stream & \case+ case stream of Return r -> Control.return r Effect ms -> ms Control.>>= effects Step (_ :> stream') -> effects stream'@@ -182,7 +182,7 @@ where loop :: Stream (Of a) m r %1 -> Stream Identity m r loop stream =- stream & \case+ case stream of Return r -> Return r Step (_ :> stream') -> Step $ Identity (erase stream') Effect ms -> Effect $ ms Control.>>= (Control.return . erase)@@ -242,7 +242,7 @@ where loop :: Stream (Of a) m r %1 -> m r loop stream =- stream & \case+ case stream of Return r -> Control.return r Effect ms -> ms Control.>>= mapM_ f Step (a :> stream') -> Control.do@@ -302,7 +302,7 @@ where loop :: Stream (Of a) m r %1 -> m (Of b r) loop stream =- stream & \case+ case stream of Return r -> Control.return $ g x :> r Effect ms -> ms Control.>>= fold f x g Step (a :> stream') -> fold f (f x a) g stream'@@ -335,7 +335,7 @@ where loop :: Stream (Of a) m r %1 -> m b loop stream =- stream & \case+ case stream of Return r -> lseq r $ Control.return $ g x Effect ms -> ms Control.>>= fold_ f x g Step (a :> stream') -> fold_ f (f x a) g stream'@@ -370,7 +370,7 @@ where loop :: Stream (Of a) m r %1 -> m (b, r) loop stream =- stream & \case+ case stream of Return r -> mx Control.>>= g Control.>>= (\b -> Control.return (b, r)) Effect ms -> ms Control.>>= foldM f mx g Step (a :> stream') -> foldM f (mx Control.>>= \x -> f x a) g stream'@@ -391,7 +391,7 @@ where loop :: Stream (Of a) m r %1 -> m b loop stream =- stream & \case+ case stream of Return r -> lseq r $ mx Control.>>= g Effect ms -> ms Control.>>= foldM_ f mx g Step (a :> stream') -> foldM_ f (mx Control.>>= \x -> f x a) g stream'@@ -464,7 +464,7 @@ -- first element, performing all monadic effects via 'effects' head :: (Control.Monad m) => Stream (Of a) m r %1 -> m (Of (Maybe a) r) head str =- str & \case+ case str of Return r -> Control.return (Nothing :> r) Effect m -> m Control.>>= head Step (a :> rest) ->@@ -475,7 +475,7 @@ -- first element, performing all monadic effects via 'effects' head_ :: (Consumable r, Control.Monad m) => Stream (Of a) m r %1 -> m (Maybe a) head_ str =- str & \case+ case str of Return r -> lseq r $ Control.return Nothing Effect m -> m Control.>>= head_ Step (a :> rest) ->@@ -491,7 +491,7 @@ Stream (Of a) m r %1 -> m (Of (Maybe a) r) loop m s =- s & \case+ case s of Return r -> Control.return (m :> r) Effect m -> m Control.>>= last Step (a :> rest) -> loop (Just a) rest@@ -506,7 +506,7 @@ Stream (Of a) m r %1 -> m (Maybe a) loop m s =- s & \case+ case s of Return r -> lseq r $ Control.return m Effect m -> m Control.>>= last_ Step (a :> rest) -> loop (Just a) rest@@ -522,7 +522,7 @@ where loop :: Stream (Of a) m r %1 -> m (Of Bool r) loop stream =- stream & \case+ case stream of Return r -> Control.return $ False :> r Effect ms -> ms Control.>>= elem a Step (a' :> stream') -> case a == a' of@@ -542,7 +542,7 @@ where loop :: Stream (Of a) m r %1 -> m Bool loop stream =- stream & \case+ case stream of Return r -> lseq r $ Control.return False Effect ms -> ms Control.>>= elem_ a Step (a' :> stream') -> case a == a' of@@ -681,7 +681,7 @@ where loop :: Stream (Of a) m r %1 -> m r loop stream =- stream & \case+ case stream of Return r -> Control.return r Effect m -> m Control.>>= foldrM step Step (a :> as) -> step a (foldrM step as)@@ -702,7 +702,7 @@ where loop :: Stream (Of a) m r %1 -> t m r loop stream =- stream & \case+ case stream of Return r -> Control.return r Effect ms -> (Control.lift ms) Control.>>= foldrT step Step (a :> as) -> step a (foldrT step as)
src/Streaming/Linear/Internal/Many.hs view
@@ -36,7 +36,7 @@ where import qualified Control.Functor.Linear as Control-import Prelude.Linear (($), (&))+import Prelude.Linear (($)) import Streaming.Linear.Internal.Consume import Streaming.Linear.Internal.Type import Prelude (Either (..), Ord (..), Ordering (..))@@ -115,7 +115,7 @@ Stream (Of (a, b)) m r %1 -> Stream (Of a) (Stream (Of b) m) r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop $ Control.lift m Step ((a, b) :> rest) -> Step (a :> Effect (Step (b :> Return (loop rest))))@@ -169,14 +169,14 @@ Stream (Of b) m r2 %1 -> Stream (Of c) m (ZipResidual a b m r1 r2) loop f st1 st2 =- st1 & \case+ case st1 of Effect ms -> Effect $ Control.fmap (\s -> loop f s st2) ms Return r1 ->- st2 & \case+ case st2 of Return r2 -> Return $ Left3 (r1, r2) st2' -> Return $ Middle3 (r1, st2') Step (a :> as) ->- st2 & \case+ case st2 of Effect ms -> Effect $ Control.fmap (\s -> loop f (Step (a :> as)) s) ms Return r2 -> Return $ Right3 (Step (a :> as), r2)@@ -191,7 +191,7 @@ Stream (Of c) m (r1, r2) zipWith f s1 s2 = Control.do result <- zipWithR f s1 s2- result & \case+ case result of Left3 rets -> Control.return rets Middle3 (r1, s2') -> Control.do r2 <- Control.lift $ effects s2'@@ -251,20 +251,20 @@ Stream (Of c) m r3 %1 -> Stream (Of d) m (ZipResidual3 a b c m r1 r2 r3) loop f s1 s2 s3 =- s1 & \case+ case s1 of Effect ms -> Effect $ Control.fmap (\s -> loop f s s2 s3) ms Return r1 ->- (s2, s3) & \case+ case (s2, s3) of (Return r2, Return r3) -> Return (Left r1, Left r2, Left r3) (s2', s3') -> Return (Left r1, Right s2', Right s3') Step (a :> as) ->- s2 & \case+ case s2 of Effect ms -> Effect $ Control.fmap (\s -> loop f (Step $ a :> as) s s3) ms Return r2 -> Return (Right (Step $ a :> as), Left r2, Right s3) Step (b :> bs) ->- s3 & \case+ case s3 of Effect ms -> Effect $ Control.fmap (\s -> loop f (Step $ a :> as) (Step $ b :> bs) s) ms@@ -283,7 +283,7 @@ Stream (Of d) m (r1, r2, r3) zipWith3 f s1 s2 s3 = Control.do result <- zipWith3R f s1 s2 s3- result & \case+ case result of (res1, res2, res3) -> Control.do r1 <- Control.lift $ extractResult res1 r2 <- Control.lift $ extractResult res2@@ -377,14 +377,14 @@ where loop :: Stream (Of a) m r %1 -> Stream (Of a) m s %1 -> Stream (Of a) m (r, s) loop s1 s2 =- s1 & \case+ case s1 of Return r -> Effect $ effects s2 Control.>>= \s -> Control.return $ Return (r, s) Effect ms -> Effect $ ms Control.>>= \s1' -> Control.return $ mergeBy comp s1' s2 Step (a :> as) ->- s2 & \case+ case s2 of Return s -> Effect $ effects as Control.>>= \r -> Control.return $ Return (r, s) Effect ms ->
src/Streaming/Linear/Internal/Process.hs view
@@ -96,7 +96,7 @@ import qualified Data.Set as Set import Data.Unrestricted.Linear import GHC.Stack-import Prelude.Linear (($), (&), (.))+import Prelude.Linear (($), (.)) import Streaming.Linear.Internal.Type import System.IO.Linear import Text.Read (readMaybe)@@ -128,7 +128,7 @@ Stream (Stream (Of a) m) m r %1 -> Stream (Stream (Of a) m) m r consFirstChunk a stream =- stream & \case+ case stream of Return r -> Step (Step (a :> Return (Return r))) Effect m -> Effect $ Control.fmap (consFirstChunk a) m Step f -> Step (Step (a :> f))@@ -151,7 +151,7 @@ Stream f m r %1 -> b loop stream =- stream & \case+ case stream of Return r -> done r Effect m -> theEffect (Control.fmap loop m) Step f -> construct (Control.fmap loop f)@@ -180,7 +180,7 @@ where loop :: Stream (Of a) m r %1 -> m (Either r (Ur a, Stream (Of a) m r)) loop stream =- stream & \case+ case stream of Return r -> Control.return $ Left r Effect ms -> ms Control.>>= next Step (a :> as) -> Control.return $ Right (Ur a, as)@@ -196,7 +196,7 @@ where loop :: Stream (Of a) m r %1 -> m (Maybe (a, Stream (Of a) m r)) loop stream =- stream & \case+ case stream of Return r -> lseq r $ Control.return Nothing Effect ms -> ms Control.>>= uncons Step (a :> as) -> Control.return $ Just (a, as)@@ -219,7 +219,7 @@ loop :: Int -> Stream f m r %1 -> Stream f m (Stream f m r) loop n stream = case Prelude.compare n 0 of GT ->- stream & \case+ case stream of Return r -> Return (Return r) Effect m -> Effect $ m Control.>>= (Control.return . splitAt n) Step f -> Step $ Control.fmap (splitAt (n - 1)) f@@ -244,7 +244,7 @@ where loop :: Stream (Of a) m r %1 -> Stream (Stream (Of a) m) m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ m Control.>>= (Control.return . split x) Step (a :> as) -> case a == x of@@ -273,7 +273,7 @@ where loop :: Stream (Of a) m r %1 -> Stream (Of a) m (Stream (Of a) m r) loop stream =- stream & \case+ case stream of Return r -> Return (Return r) Effect m -> Effect $ Control.fmap (break f) m Step (a :> as) -> case f a of@@ -303,7 +303,7 @@ where loop :: Stream (Of a) m r %1 -> Stream (Stream (Of a) m) m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap (breaks f) m Step (a :> as) -> case f a of@@ -347,7 +347,7 @@ where loop :: Stream (Of a) m r %1 -> Stream (Of a) m (Stream (Of a) m r) loop stream =- stream & \case+ case stream of Return r -> Return (Return r) Effect m -> Effect $ Control.fmap (breakWhen step x end pred) m Step (a :> as) -> case pred (end (step x a)) of@@ -395,11 +395,11 @@ where loop :: Stream (Of a) m r %1 -> Stream (Stream (Of a) m) m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap (groupBy equals) m Step (a :> as) ->- as & \case+ case as of Return r -> Step (Step (a :> Return (Return r))) Effect m -> Effect $@@ -523,7 +523,7 @@ where fromSum :: Sum f g (Stream f (Stream g m) r) %1 -> (Stream f (Stream g m) r) fromSum x =- x & \case+ case x of InL fss -> Step fss InR gss -> Effect (Step $ Control.fmap Return gss) {-# INLINEABLE separate #-}@@ -551,7 +551,7 @@ where loop :: Stream (Of a) m r %1 -> Stream (Of a) (Stream (Of a) m) r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect (Control.fmap loop (Control.lift m)) Step (a :> as) -> case pred a of@@ -576,7 +576,7 @@ Stream (Of (Either a b)) m r %1 -> Stream (Of a) (Stream (Of b) m) r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop (Control.lift m) Step (Left a :> as) -> Step (a :> loop as)@@ -593,7 +593,7 @@ where loop :: (Control.Monad m) => Stream (Of (Maybe a)) m r %1 -> Stream (Of a) m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap catMaybes m Step (maybe :> as) -> case maybe of@@ -614,7 +614,7 @@ where loop :: Stream (Of a) m r %1 -> Stream (Of b) m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect ms -> Effect $ ms Control.>>= (Control.return . mapMaybe f) Step (a :> s) -> case f a of@@ -639,12 +639,12 @@ where loop :: Stream (Of a) m r %1 -> Stream (Of b) m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap (mapMaybeM f) m Step (a :> as) -> Effect $ Control.do mb <- f a- mb & \case+ case mb of Nothing -> Control.return $ mapMaybeM f as Just (Ur b) -> Control.return $ Step (b :> mapMaybeM f as) {-# INLINEABLE mapMaybeM #-}@@ -668,7 +668,7 @@ where loop :: Stream f m r %1 -> Stream f n r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ f $ Control.fmap loop m Step f -> Step $ Control.fmap loop f@@ -706,7 +706,7 @@ where loop :: Stream f m r %1 -> Stream g m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap (maps phi) m Step f -> Step (phi (Control.fmap loop f))@@ -745,7 +745,7 @@ Stream (Of a) m r %1 -> Stream (Of b) m r loop f stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap (loop f) m Step (a :> as) -> Effect $ Control.do@@ -773,7 +773,7 @@ where loop :: Stream f m r %1 -> Stream g m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop m Step f -> Step $ Control.fmap loop $ phi f@@ -825,7 +825,7 @@ where loop :: Stream f m r %1 -> Stream g m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop m Step f -> Effect $ Control.fmap Step $ phi $ Control.fmap loop f@@ -854,7 +854,7 @@ where loop :: Stream f m r %1 -> Stream g m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop m Step f -> Effect $ Control.fmap (Step . Control.fmap loop) $ phi f@@ -873,7 +873,7 @@ where loop :: Stream f m r %1 -> Stream g m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop m Step f -> Effect $ Control.fmap (Step . Control.fmap loop) $ phi f@@ -891,7 +891,7 @@ where loop :: Stream (Of a) m r %1 -> Stream f m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop m Step (a :> as) -> Control.do@@ -929,7 +929,7 @@ where loop :: Stream (Of a) m r %1 -> Stream f m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop m Step (a :> as) -> Step $ Control.fmap (`lseq` (loop as)) (f a)@@ -1060,7 +1060,7 @@ where loop :: Stream (Of a) m r %1 -> Stream (Of a) (Stream (Of a) m) r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop (Control.lift m) Step (a :> as) -> Effect $ Step (a :> Return (Step (a :> loop as)))@@ -1193,7 +1193,7 @@ where loop :: Stream (Of a) m r %1 -> Stream (Of a) m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop m Step (a :> as) -> Effect $ Control.do@@ -1221,7 +1221,7 @@ where loop :: Stream (Of (m (Ur a))) m r %1 -> Stream (Of a) m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop m Step (ma :> mas) -> Effect $ Control.do@@ -1246,7 +1246,7 @@ where loop :: Set.Set b -> Stream (Of a) m r %1 -> Stream (Of a) m r loop !set stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap (loop set) m Step (a :> as) -> case Set.member (f a) set of@@ -1268,7 +1268,7 @@ where loop :: IntSet.IntSet -> Stream (Of a) m r %1 -> Stream (Of a) m r loop !set stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap (loop set) m Step (a :> as) -> case IntSet.member (f a) set of@@ -1286,7 +1286,7 @@ where loop :: Stream (Of a) m r %1 -> Stream (Of a) m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop m Step (a :> as) -> case pred a of@@ -1305,12 +1305,12 @@ where loop :: Stream (Of a) m r %1 -> Stream (Of a) m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop m Step (a :> as) -> Effect $ Control.do bool <- pred a- bool & \case+ case bool of True -> Control.return $ Step (a :> loop as) False -> Control.return $ loop as {-# INLINE filterM #-}@@ -1332,7 +1332,7 @@ Stream (Of a) m r %1 -> Stream (Of a) m r intersperse x stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap (intersperse x) m Step (a :> as) -> loop a as@@ -1341,7 +1341,7 @@ -- element named 'x' loop :: a -> Stream (Of a) m r %1 -> Stream (Of a) m r loop !a stream =- stream & \case+ case stream of Return r -> Step (a :> Return r) Effect m -> Effect $ Control.fmap (loop a) m Step (a' :> as) -> Step (a :> Step (x :> loop a' as))@@ -1379,7 +1379,7 @@ where loop :: Stream (Of a) m r %1 -> Stream (Of a) m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap (drop n) m Step (_ :> as) -> drop (n - 1) as@@ -1407,7 +1407,7 @@ where loop :: Stream (Of a) m r %1 -> Stream (Of a) m r loop stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap loop m Step (a :> as) -> case pred a of@@ -1448,7 +1448,7 @@ where loop :: x -> Stream (Of a) m r %1 -> Stream (Of b) m r loop !acc stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap (loop acc) m Step (a :> as) -> Step (done acc' :> loop acc' as)@@ -1486,7 +1486,7 @@ where loop :: Stream (Of a) m r %1 -> Stream (Of b) m r loop stream =- stream & \case+ case stream of Return r -> Effect $ Control.do Ur x <- mx Ur b <- done x@@ -1525,7 +1525,7 @@ where loop :: x -> Stream (Of a) m r %1 -> Stream (Of (a, b)) m r loop !x stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.fmap (loop x) m Step (a :> as) -> Control.do@@ -1562,7 +1562,7 @@ loop :: Stream (Of a) IO r %1 -> Stream (Of a) IO r loop stream = Control.do e <- Control.lift $ next stream- e & \case+ case e of Left r -> Return r Right (Ur a, rest) -> Control.do Step (a :> Return ()) -- same as yield@@ -1605,7 +1605,7 @@ Stream f m r %1 -> Stream f m r wrapEffect ma action stream =- stream & \case+ case stream of Return r -> Return r Effect m -> Effect $ Control.do a <- ma@@ -1640,7 +1640,7 @@ window :: Seq.Seq a -> Stream (Of a) m b %1 -> Stream (Of (Seq.Seq a)) m b window !sequ str = Control.do e <- Control.lift (next str)- e & \case+ case e of Left r -> Control.return r Right (Ur a, rest) -> Control.do Step $ (sequ Seq.|> a) :> Return () -- same as yield@@ -1653,7 +1653,7 @@ window (Seq.drop 1 sequ) str setup n' sequ str = Control.do e <- Control.lift $ next str- e & \case+ case e of Left r -> Control.do Step (sequ :> Return ()) -- same as yield Control.return r
src/Streaming/Linear/Internal/Produce.hs view
@@ -49,7 +49,7 @@ import qualified Data.Text as Text import Data.Unrestricted.Linear import GHC.Stack-import Prelude.Linear (($), (&))+import Prelude.Linear (($)) import Streaming.Linear.Internal.Consume (effects) import Streaming.Linear.Internal.Process import Streaming.Linear.Internal.Type@@ -206,7 +206,7 @@ loop :: m (Stream (Of a) m r) loop = Control.do either <- mEither- either & \case+ case either of Left (Ur a) -> Control.return $ Step $ a :> (untilRight mEither) Right r -> Control.return $ Return r@@ -249,7 +249,7 @@ | n <= 0 = Effect $ Control.fmap Control.return $ end s | otherwise = Effect $ Control.do next <- step s- next & \case+ case next of Right r -> Control.return (Return r) Left fx -> Control.return $@@ -270,11 +270,11 @@ loop :: (a -> m Bool) -> AffineStream (Of a) m r %1 -> Stream (Of a) m r loop test (AffineStream s step end) = Effect $ Control.do next <- step s- next & \case+ case next of Right r -> Control.return (Return r) Left (a :> next) -> Control.do testResult <- test a- testResult & \case+ case testResult of False -> Control.return $ Step $@@ -294,7 +294,7 @@ loop :: (a -> Bool) -> AffineStream (Of a) m r %1 -> Stream (Of a) m r loop test (AffineStream s step end) = Effect $ Control.do next <- step s- next & \case+ case next of Right r -> Control.return (Return r) Left (a :> next) -> case test a of True -> Control.fmap Control.return $ end next@@ -318,7 +318,7 @@ AffineStream (Of a) m r2 %1 -> Stream (Of (x, a)) m (r1, r2) loop stream (AffineStream s step end) =- stream & \case+ case stream of Return r1 -> Effect $ Control.fmap (\r2 -> Control.return $ (r1, r2)) $@@ -328,7 +328,7 @@ Control.fmap (\str -> loop str (AffineStream s step end)) m Step (x :> rest) -> Effect $ Control.do next <- step s- next & \case+ case next of Right r2 -> Control.do r1 <- effects rest Control.return (Return (r1, r2))@@ -410,7 +410,7 @@ (Ur (Stream f m r), Stream f m r) %1 -> m (Either (f (Ur (Stream f m r), Stream f m r)) r) stepStream (Ur s, str) =- str & \case+ case str of Return r -> lseq r $ stepStream (Ur s, s) Effect m -> m Control.>>= (\stream -> stepStream (Ur s, stream))
+ test-examples/Main.hs view
@@ -0,0 +1,16 @@+module Main where++import Test.Foreign (foreignGCTests)+import Test.Simple.Quicksort (quicksortTests)+import Test.Tasty++main :: IO ()+main = defaultMain allTests++allTests :: TestTree+allTests =+ testGroup+ "All tests"+ [ foreignGCTests,+ quicksortTests+ ]
+ test-examples/Test/Foreign.hs view
@@ -0,0 +1,102 @@+{-# LANGUAGE LinearTypes #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE NoImplicitPrelude #-}++module Test.Foreign (foreignGCTests) where++import Control.Exception hiding (assert)+import Control.Monad (void)+import Data.Typeable+import qualified Foreign.Heap as Heap+import Foreign.List (List)+import qualified Foreign.List as List+import qualified Foreign.Marshal.Pure as Manual+import Hedgehog+import qualified Hedgehog.Gen as Gen+import qualified Hedgehog.Range as Range+import Prelude.Linear+import Test.Tasty+import Test.Tasty.Hedgehog (testPropertyNamed)+import qualified Prelude++-- # Organizing tests+-------------------------------------------------------------------------------++foreignGCTests :: TestTree+foreignGCTests =+ testGroup+ "foreignGCTests"+ [ listExampleTests,+ heapExampleTests+ ]++listExampleTests :: TestTree+listExampleTests =+ testGroup+ "list tests"+ [ testPropertyNamed "List.toList . List.fromList = id" "invertNonGCList" invertNonGCList,+ testPropertyNamed "map id = id" "mapIdNonGCList" mapIdNonGCList,+ testPropertyNamed "memory freed post-exception" "testExceptionOnMem" testExceptionOnMem+ ]++heapExampleTests :: TestTree+heapExampleTests =+ testGroup+ "heap tests"+ [testPropertyNamed "sort = heapsort" "nonGCHeapSort" nonGCHeapSort]++-- # Internal library+-------------------------------------------------------------------------------++list :: Gen [Int]+list = Gen.list (Range.linear 0 1000) (Gen.int (Range.linear 0 100))++eqList ::+ forall a.+ (Manual.Representable a, Movable a, Eq a) =>+ List a %1 ->+ List a %1 ->+ Ur Bool+eqList l1 l2 = move $ (List.toList l1) == (List.toList l2)++data InjectedError = InjectedError+ deriving (Typeable, Show)++instance Exception InjectedError++-- # Properties+-------------------------------------------------------------------------------++invertNonGCList :: Property+invertNonGCList = property $ do+ xs <- forAll list+ let xs' =+ unur $+ Manual.withPool (\p -> move $ List.toList $ List.ofList xs p)+ xs === xs'++mapIdNonGCList :: Property+mapIdNonGCList = property $ do+ xs <- forAll list+ let boolTest = unur $+ Manual.withPool $ \p ->+ dup3 p & \(p0, p1, p2) ->+ eqList (List.ofList xs p0) (List.map id (List.ofList xs p1) p2)+ assert boolTest++testExceptionOnMem :: Property+testExceptionOnMem = property $ do+ xs <- forAll list+ let bs = xs ++ (throw InjectedError)+ let writeBadList = Manual.withPool (move . List.toList . List.ofRList bs)+ let ignoreCatch = \_ -> Prelude.return ()+ evalIO (catch @InjectedError (void (evaluate writeBadList)) ignoreCatch)++nonGCHeapSort :: Property+nonGCHeapSort = property $ do+ xs <- forAll list+ let ys :: [(Int, ())] = zip xs $ Prelude.replicate (Prelude.length xs) ()+ (Heap.sort ys) === (reverse $ sort ys)
+ test-examples/Test/Simple/Quicksort.hs view
@@ -0,0 +1,29 @@+{-# LANGUAGE OverloadedStrings #-}++module Test.Simple.Quicksort (quicksortTests) where++import Data.List (sort)+import Hedgehog+import qualified Hedgehog.Gen as Gen+import qualified Hedgehog.Range as Range+import Simple.Quicksort (quicksortUsingArray, quicksortUsingList)+import Test.Tasty+import Test.Tasty.Hedgehog (testPropertyNamed)++quicksortTests :: TestTree+quicksortTests =+ testGroup+ "quicksort tests"+ [ testPropertyNamed "sort xs === quicksortUsingArray xs" "testQuicksortUsingArray" testQuicksortUsingArray,+ testPropertyNamed "sort xs === quicksortUsingList xs" "testQuicksortUsingList" testQuicksortUsingList+ ]++testQuicksortUsingArray :: Property+testQuicksortUsingArray = property $ do+ xs <- forAll $ Gen.list (Range.linear 0 1000) (Gen.int $ Range.linear 0 100)+ sort xs === quicksortUsingArray xs++testQuicksortUsingList :: Property+testQuicksortUsingList = property $ do+ xs <- forAll $ Gen.list (Range.linear 0 1000) (Gen.int $ Range.linear 0 100)+ sort xs === quicksortUsingList xs
test/Main.hs view
@@ -4,6 +4,8 @@ module Main where import Test.Data.Destination (destArrayTests)+import Test.Data.Functor.Linear (genericTests)+import Test.Data.List (listTests) import Test.Data.Mutable.Array (mutArrTests) import Test.Data.Mutable.HashMap (mutHMTests) import Test.Data.Mutable.Set (mutSetTests)@@ -27,7 +29,9 @@ mutHMTests, mutSetTests, destArrayTests,- polarizedArrayTests+ polarizedArrayTests,+ listTests,+ genericTests ], testGroup "Inspection tests"
+ test/Test/Data/Functor/Linear.hs view
@@ -0,0 +1,59 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DeriveAnyClass #-}+{-# LANGUAGE DerivingVia #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE LinearTypes #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE NoImplicitPrelude #-}++module Test.Data.Functor.Linear (genericTests) where++import Data.Functor.Linear (genericTraverse)+import qualified Data.Functor.Linear as Data+import Generics.Linear.TH+import Hedgehog+import Prelude.Linear+import Test.Tasty+import Test.Tasty.Hedgehog (testPropertyNamed)+import qualified Prelude++data Pair a = MkPair a a+ deriving (Show, Prelude.Eq)++$(deriveGeneric1 ''Pair)++instance Data.Functor Pair where+ fmap f (MkPair x y) = MkPair (f x) (f y)++instance Data.Traversable Pair where+ traverse = genericTraverse++genericTests :: TestTree+genericTests =+ testGroup+ "Generic tests"+ [ genericTraverseTests+ ]++genericTraverseTests :: TestTree+genericTraverseTests =+ testGroup+ "genericTraverse examples"+ [pairTest]++pairTest :: TestTree+pairTest =+ testPropertyNamed "traverse via genericTraverse with WithLog and Pair" "propertyPairTest" propertyPairTest++propertyPairTest :: Property+propertyPairTest =+ property $+ ( Data.traverse+ (\x -> (Sum (1 :: Int), 2 * x))+ (MkPair 3 4 :: Pair Int)+ )+ === (Sum 2, (MkPair 6 8))
+ test/Test/Data/List.hs view
@@ -0,0 +1,43 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE NoImplicitPrelude #-}++module Test.Data.List (listTests) where++import qualified Data.List.Linear as List+import Hedgehog+import qualified Hedgehog.Gen as Gen+import qualified Hedgehog.Range as Range+import Prelude.Linear+import Test.Tasty+import Test.Tasty.Hedgehog (testPropertyNamed)+import qualified Prelude++listTests :: TestTree+listTests =+ testGroup+ "List tests"+ [ testPropertyNamed "take n ++ drop n = id" "take_drop" take_drop,+ testPropertyNamed "length . take n = const n" "take_length" take_length+ ]++take_drop :: Property+take_drop = property $ do+ n <- forAll $ Gen.int (Range.linear 0 50)+ classify "0" $ n == 0+ xs <- forAll $ Gen.list (Range.linear 0 1000) (Gen.int (Range.linear 0 40))+ classify "length > n" $ Prelude.length xs > n+ List.take n xs ++ List.drop n xs === xs++take_length :: Property+take_length = property $ do+ n <- forAll $ Gen.int (Range.linear 0 50)+ classify "0" $ n == 0+ xs <- forAll $ Gen.list (Range.linear 0 1000) (Gen.int (Range.linear 0 40))+ classify "length > n" $ Prelude.length xs > n+ case Prelude.length xs > n of+ True -> do+ annotate "Prelude.length xs > n"+ Prelude.length (List.take n xs) === n+ False -> do+ annotate "Prelude.length xs < n"+ Prelude.length (List.take n xs) === Prelude.length xs
test/Test/Data/Mutable/Vector.hs view
@@ -354,7 +354,7 @@ where popAll :: [a] -> Vector.Vector a %1 -> Ur [a] popAll acc vec =- Vector.pop vec Linear.& \case+ case Vector.pop vec of (Ur Nothing, vec') -> vec' `lseq` Ur acc (Ur (Just x), vec') -> popAll (x : acc) vec'
test/Test/Data/Polarized.hs view
@@ -6,6 +6,7 @@ import qualified Data.Array.Polarized as Polar import qualified Data.Array.Polarized.Pull as Pull import qualified Data.Array.Polarized.Push as Push+import Data.Functor.Linear (fmap) import qualified Data.Vector as Vector import Hedgehog import qualified Hedgehog.Gen as Gen@@ -34,10 +35,12 @@ testPropertyNamed "Push.make ~ Vec.replicate" "pushMake" pushMake, testPropertyNamed "Pull.append ~ Vec.append" "pullAppend" pullAppend, testPropertyNamed "Pull.asList . Pull.fromVector ~ id" "pullAsList" pullAsList,+ testPropertyNamed "Pull.empty = []" "pullEmpty" pullEmpty, testPropertyNamed "Pull.singleton x = [x]" "pullSingleton" pullSingleton, testPropertyNamed "Pull.splitAt ~ splitAt" "pullSplitAt" pullSplitAt, testPropertyNamed "Pull.make ~ Vec.replicate" "pullMake" pullMake,- testPropertyNamed "Pull.zip ~ zip" "pullZip" pullZip+ testPropertyNamed "Pull.zip ~ zip" "pullZip" pullZip,+ testPropertyNamed "Pull.uncons ~ uncons" "pullUncons" pullUncons ] list :: Gen [Int]@@ -88,6 +91,10 @@ xs <- forAll list xs === Pull.asList (Pull.fromVector (Vector.fromList xs)) +pullEmpty :: Property+pullEmpty = property Prelude.$ do+ ([] :: [Int]) === Pull.asList Pull.empty+ pullSingleton :: Property pullSingleton = property Prelude.$ do x <- forAll randInt@@ -115,3 +122,8 @@ let xs' = Pull.fromVector (Vector.fromList xs) let ys' = Pull.fromVector (Vector.fromList ys) zip xs ys === Pull.asList (Pull.zip xs' ys')++pullUncons :: Property+pullUncons = property Prelude.$ do+ xs <- forAll list+ uncons xs === fmap (fmap Pull.asList) (Pull.uncons (Pull.fromVector (Vector.fromList xs)))
test/Test/Data/Replicator.hs view
@@ -23,9 +23,9 @@ manualElim3 :: (a %1 -> a %1 -> a %1 -> [a]) %1 -> Replicator a %1 -> [a] manualElim3 f r =- Replicator.next r & \case+ case Replicator.next r of (x, r') ->- Replicator.next r' & \case+ case Replicator.next r' of (y, r'') ->- Replicator.extract r'' & \case+ case Replicator.extract r'' of z -> f x y z
test/Test/Data/V.hs view
@@ -32,11 +32,11 @@ manualElim3 :: (a %1 -> a %1 -> a %1 -> [a]) %1 -> V 3 a %1 -> [a] manualElim3 f v =- V.uncons v & \case+ case V.uncons v of (x, v') ->- V.uncons v' & \case+ case V.uncons v' of (y, v'') ->- V.uncons v'' & \case+ case V.uncons v'' of (z, v''') ->- V.consume v''' & \case+ case V.consume v''' of () -> f x y z