fcf-containers-0.8.2: Data structures and algorithms for first-class-families
Copyright(c) gspia 2023-
LicenseBSD
Maintainergspia
Safe HaskellSafe-Inferred
LanguageHaskell2010

Fcf.Data.List.Utils

Description

Fcf.Data.List.Utils

Some of the following methods would probably have better place at the first-class-families library. That is, polish and make a PR.

Synopsis

Documentation

>>> import qualified GHC.TypeLits as TL
>>> import           Fcf.Data.Nat

data Foldl :: (b -> a -> Exp b) -> b -> t a -> Exp b Source #

Foldl in terms of Foldr.

Example

Expand
>>> :kind! Eval (Foldl (Fcf.-) 10 '[3,2,1])
Eval (Foldl (Fcf.-) 10 '[3,2,1]) :: TL.Natural
= 4

Instances

Instances details
type Eval (Foldl f b ta :: a1 -> Type) Source # 
Instance details

Defined in Fcf.Data.List.Utils

type Eval (Foldl f b ta :: a1 -> Type) = Eval (Foldr (Flip f) b (Eval (Reverse ta)))

data MaybeToList :: Maybe a -> Exp [a] Source #

Turn Maybe into a list.

Example

Expand
>>> :kind! Eval (MaybeToList ('Just 1))
Eval (MaybeToList ('Just 1)) :: [TL.Natural]
= '[1]

Instances

Instances details
type Eval (MaybeToList ('Nothing :: Maybe a) :: [a] -> Type) Source # 
Instance details

Defined in Fcf.Data.List.Utils

type Eval (MaybeToList ('Nothing :: Maybe a) :: [a] -> Type) = '[] :: [a]
type Eval (MaybeToList ('Just a) :: [k] -> Type) Source # 
Instance details

Defined in Fcf.Data.List.Utils

type Eval (MaybeToList ('Just a) :: [k] -> Type) = '[a]