Safe Haskell | None |
---|---|
Language | Haskell2010 |
Built-in list
and related functions.
Synopsis
- list :: uni `Contains` [] => Type TyName uni ()
- caseList :: TermLike term TyName Name DefaultUni DefaultFun => term ()
- foldrList :: TermLike term TyName Name DefaultUni DefaultFun => term ()
- foldList :: TermLike term TyName Name DefaultUni DefaultFun => term ()
- sum :: TermLike term TyName Name DefaultUni DefaultFun => term ()
- sumr :: TermLike term TyName Name DefaultUni DefaultFun => term ()
- product :: TermLike term TyName Name DefaultUni DefaultFun => term ()
Documentation
caseList :: TermLike term TyName Name DefaultUni DefaultFun => term () Source #
Pattern matching on built-in lists. caseList {a} xs
on built-in lists is
equivalent to unwrap xs
on lists defined in PLC itself (hence why we bind r
after xs
).
/\(a :: *) -> \(xs : list a) -> /\(r :: *) -> (z : r) (f : a -> list a -> r) -> chooseList {a} {() -> r} xs (\(u : ()) -> z) (\(u : ()) -> f (head {a} xs) (tail {a} xs)) ()
foldrList :: TermLike term TyName Name DefaultUni DefaultFun => term () Source #
foldr
over built-in lists.
/\(a :: *) (r :: *) -> \(f : a -> r -> r) (z : r) -> fix {list a} {r} \(rec : list a -> r) (xs : list a) -> caseList {a} xs {r} z \(x : a) (xs' : list a) -> f x (rec xs')
foldList :: TermLike term TyName Name DefaultUni DefaultFun => term () Source #
'foldl'' as a PLC term.
/\(a :: *) (r :: *) -> \(f : r -> a -> r) -> fix {r} {list a -> r} \(rec : r -> list a -> r) (z : r) (xs : list a) -> caseList {a} xs {r} z \(x : a) (xs' : list a) -> rec (f z x) xs'
sum :: TermLike term TyName Name DefaultUni DefaultFun => term () Source #
sumr :: TermLike term TyName Name DefaultUni DefaultFun => term () Source #
product :: TermLike term TyName Name DefaultUni DefaultFun => term () Source #
product
as a PLC term.
foldList {integer} {integer} multiplyInteger 1