Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
4 contributors

Users who have contributed to this file

@evilsoft @dalefrancis88 @sauzy34 @RichardForrester
218 lines (200 sloc) 10.6 KB
title description layout icon weight
Crocks
Crocks API
notopic
code-file
2

The crocks are the heart and soul of this library. This is where you will find all your favorite ADT's you have grown to love. They include gems such as: Maybe, Either and IO, to name a few. They are usually just a simple constructor that takes either a function or value (depending on the type) and will return you a "container" that wraps whatever you passed it. Each container provides a variety of functions that act as the operations you can do on the contained value. There are many types that share the same function names, but what they do from type to type may vary.

Crock Constructor Instance
Arrow id both, compose, contramap,first, map, promap, runWith, second
Async Rejected, Resolved, all, resolveAfter, rejectAfter, fromNode, fromPromise, of alt, ap, bichain, bimap, chain, coalesce, fork, map, of, race, swap, toPromise
Const empty, of ap, concat, empty, equals, map, of, valueOf
Either Left, Right, of alt, ap, bichain, bimap, chain, coalesce, concat, either, equals, map, of, sequence, swap, traverse
Equiv empty concat, contramap, compareWith, valueOf
Identity of ap, chain, concat, equals, map, of, sequence, traverse, valueOf
IO of ap, chain, map, of, run
List empty, fromArray, of ap, chain, concat, cons, empty, equals, filter, fold, foldMap, head, init, last, map, of, reduce, reduceRight, reject, sequence, tail, toArray, traverse, valueOf
Maybe Nothing, Just, of, zero alt, ap, bichain, chain, coalesce, concat, equals, either, map, of, option, sequence, traverse, zero
Pair --- ap, bimap, chain, concat, equals, extend, fst, map, merge, sequence, snd, swap, traverse, toArray
Pred * empty concat, contramap, runWith, valueOf
Reader ask, of ap, chain, map, runWith
ReaderT ask, lift, liftFn, of ap, chain, map, runWith
Result Err, Ok, of alt, ap, bichain, bimap, chain, coalesce, concat, either, equals, map, of, sequence, swap, traverse
Star id both, compose, contramap, map, promap, runWith
State get, modify, of, put ap, chain, evalWith, execWith, map, runWith
Tuple --- concat, equals, map, mapAll, merge, project, toArray
Unit empty, of ap, chain, concat, empty, equals, map, of, valueOf
Writer of ap, chain, equals, log, map, of, read, valueOf

* based on this article

You can’t perform that action at this time.