copilot-libraries-3.0: Libraries for the Copilot language.

Copyright(c) 2011 National Institute of Aerospace / Galois Inc.
Safe HaskellSafe
LanguageHaskell2010

Copilot.Library.Utils

Contents

Description

Utility bounded-list functions (e.g., folds, scans, etc.)

Synopsis
  • take :: (Integral a, Typed b) => a -> Stream b -> [Stream b]
  • tails :: Typed a => Stream a -> [Stream a]
  • cycle :: Typed a => [a] -> Stream a
  • nfoldl :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream a) -> Stream a -> Stream b -> Stream a
  • nfoldl1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> Stream a
  • nfoldr :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream b) -> Stream b -> Stream a -> Stream b
  • nfoldr1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> Stream a
  • nscanl :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream a) -> Stream a -> Stream b -> [Stream a]
  • nscanr :: Typed a => Int -> (Stream a -> Stream b -> Stream b) -> Stream b -> Stream a -> [Stream b]
  • nscanl1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> [Stream a]
  • nscanr1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> [Stream a]
  • case' :: Typed a => [Stream Bool] -> [Stream a] -> Stream a
  • (!!) :: (Typed a, Eq b, Num b, Typed b) => [Stream a] -> Stream b -> Stream a

Functions similar to the Prelude functions on lists

take :: (Integral a, Typed b) => a -> Stream b -> [Stream b] Source #

tails :: Typed a => Stream a -> [Stream a] Source #

cycle :: Typed a => [a] -> Stream a Source #

Folds

nfoldl :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream a) -> Stream a -> Stream b -> Stream a Source #

nfoldl1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> Stream a Source #

nfoldr :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream b) -> Stream b -> Stream a -> Stream b Source #

nfoldr1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> Stream a Source #

Scans

nscanl :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream a) -> Stream a -> Stream b -> [Stream a] Source #

nscanr :: Typed a => Int -> (Stream a -> Stream b -> Stream b) -> Stream b -> Stream a -> [Stream b] Source #

nscanl1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> [Stream a] Source #

nscanr1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> [Stream a] Source #

Indexing

case' :: Typed a => [Stream Bool] -> [Stream a] -> Stream a Source #

Case-like function: The index of the first predicate that is true in the predicate list selects the stream result. If no predicate is true, the last element is chosen (default element)

(!!) :: (Typed a, Eq b, Num b, Typed b) => [Stream a] -> Stream b -> Stream a Source #

Index. WARNING: Very expensive! Consider using this only for very short lists.