Skip to content

purescript/purescript-unfoldable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Module Documentation

Module Data.Unfoldable

This module provides a type class for unfoldable functors, i.e. functors which support an unfoldr operation.

This allows us to unify various operations on arrays, lists, sequences, etc.

Unfoldable

class Unfoldable t where
  unfoldr :: forall a b. (b -> Maybe (Tuple a b)) -> b -> t a

This class identifies data structures which can be unfolded, generalizing unfoldr on arrays.

The generating function f in unfoldr f in understood as follows:

  • If f b is Nothing, then unfoldr f b should be empty.
  • If f b is Just (Tuple a b1), then unfoldr f b should consist of a appended to the result of unfoldr f b1.

unfoldableArray

instance unfoldableArray :: Unfoldable Prim.Array

About

Unfoldable functors

Resources

License

Stars

Watchers

Forks

Contributors 11