Skip to content

Add Function.Extra!? #27

@gampleman

Description

@gampleman

Not sure if there is much appetite for this, but a Core-ish type is the function type. There are a bunch of helper functions to do with functions:

  • uncurry : (a -> b -> c) -> (a, b) -> c
  • curry : ((a, b) -> c) -> a -> b -> c
  • all sorts of function combinators: a -> b -> b, (a -> c) -> (b -> c -> d) -> a -> b -> d, yada yada
  • toFixpoint : (a -> a) -> a -> a and perhaps toFixpointWithLimit : Int -> (a -> a) -> a -> Result a a
  • while : (a -> Bool) -> (a -> a) -> a -> a and doWhile : (a -> a) -> (a -> Bool) -> a -> a
  • nTimes : Int -> (a -> a) -> a -> a

etc...

Thoughts? Opinions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    new functionRequest to add a new function to the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions