{"id":20496630,"url":"https://github.com/sanctuary-js/sanctuary-type-classes","last_synced_at":"2025-05-16T05:04:38.526Z","repository":{"id":44796960,"uuid":"58353356","full_name":"sanctuary-js/sanctuary-type-classes","owner":"sanctuary-js","description":":rainbow: Standard library for Fantasy Land","archived":false,"fork":false,"pushed_at":"2024-11-10T16:57:50.000Z","size":752,"stargazers_count":238,"open_issues_count":3,"forks_count":20,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-05-08T17:54:44.676Z","etag":null,"topics":["fantasy-land","sanctuary"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sanctuary-js.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["davidchambers","Avaq"]}},"created_at":"2016-05-09T06:24:11.000Z","updated_at":"2025-03-27T10:10:35.000Z","dependencies_parsed_at":"2024-05-16T14:43:40.591Z","dependency_job_id":null,"html_url":"https://github.com/sanctuary-js/sanctuary-type-classes","commit_stats":{"total_commits":183,"total_committers":12,"mean_commits":15.25,"dds":"0.21857923497267762","last_synced_commit":"30d0a3258b8f03caf7d1e650d1cb7a3b1c6c9040"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanctuary-js%2Fsanctuary-type-classes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanctuary-js%2Fsanctuary-type-classes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanctuary-js%2Fsanctuary-type-classes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanctuary-js%2Fsanctuary-type-classes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanctuary-js","download_url":"https://codeload.github.com/sanctuary-js/sanctuary-type-classes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471060,"owners_count":22076585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fantasy-land","sanctuary"],"created_at":"2024-11-15T18:08:10.586Z","updated_at":"2025-05-16T05:04:38.503Z","avatar_url":"https://github.com/sanctuary-js.png","language":"JavaScript","funding_links":["https://github.com/sponsors/davidchambers","https://github.com/sponsors/Avaq"],"categories":["Libraries"],"sub_categories":["[Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript)"],"readme":"# sanctuary-type-classes\n\nThe [Fantasy Land Specification][FL] \"specifies interoperability of common\nalgebraic structures\" by defining a number of type classes. For each type\nclass, it states laws which every member of a type must obey in order for\nthe type to be a member of the type class. In order for the Maybe type to\nbe considered a [Functor][], for example, every `Maybe a` value must have\na `fantasy-land/map` method which obeys the identity and composition laws.\n\nThis project provides:\n\n  - [`TypeClass`](#TypeClass), a function for defining type classes;\n  - one `TypeClass` value for each Fantasy Land type class;\n  - lawful Fantasy Land methods for JavaScript's built-in types;\n  - one function for each Fantasy Land method; and\n  - several functions derived from these functions.\n\n## Type-class hierarchy\n\n\u003cpre\u003e\n \u003ca href=\"#Setoid\"\u003eSetoid\u003c/a\u003e   \u003ca href=\"#Semigroupoid\"\u003eSemigroupoid\u003c/a\u003e  \u003ca href=\"#Semigroup\"\u003eSemigroup\u003c/a\u003e   \u003ca href=\"#Foldable\"\u003eFoldable\u003c/a\u003e        \u003ca href=\"#Functor\"\u003eFunctor\u003c/a\u003e      \u003ca href=\"#Contravariant\"\u003eContravariant\u003c/a\u003e  \u003ca href=\"#Filterable\"\u003eFilterable\u003c/a\u003e\n(\u003ca href=\"#equals\"\u003eequals\u003c/a\u003e)    (\u003ca href=\"#compose\"\u003ecompose\u003c/a\u003e)    (\u003ca href=\"#concat\"\u003econcat\u003c/a\u003e)   (\u003ca href=\"#reduce\"\u003ereduce\u003c/a\u003e)         (\u003ca href=\"#map\"\u003emap\u003c/a\u003e)        (\u003ca href=\"#contramap\"\u003econtramap\u003c/a\u003e)    (\u003ca href=\"#filter\"\u003efilter\u003c/a\u003e)\n    |           |           |           \\         / | | | | \\\n    |           |           |            \\       /  | | | |  \\\n    |           |           |             \\     /   | | | |   \\\n    |           |           |              \\   /    | | | |    \\\n    |           |           |               \\ /     | | | |     \\\n   \u003ca href=\"#Ord\"\u003eOrd\u003c/a\u003e      \u003ca href=\"#Category\"\u003eCategory\u003c/a\u003e     \u003ca href=\"#Monoid\"\u003eMonoid\u003c/a\u003e         \u003ca href=\"#Traversable\"\u003eTraversable\u003c/a\u003e | | | |      \\\n  (\u003ca href=\"#lte\"\u003elte\u003c/a\u003e)       (\u003ca href=\"#id\"\u003eid\u003c/a\u003e)       (\u003ca href=\"#empty\"\u003eempty\u003c/a\u003e)        (\u003ca href=\"#traverse\"\u003etraverse\u003c/a\u003e)  / | | \\       \\\n                            |                      /  | |  \\       \\\n                            |                     /   / \\   \\       \\\n                            |             \u003ca href=\"#Profunctor\"\u003eProfunctor\u003c/a\u003e /   \\ \u003ca href=\"#Bifunctor\"\u003eBifunctor\u003c/a\u003e \\\n                            |              (\u003ca href=\"#promap\"\u003epromap\u003c/a\u003e) /     \\ (\u003ca href=\"#bimap\"\u003ebimap\u003c/a\u003e)   \\\n                            |                      /       \\           \\\n                          \u003ca href=\"#Group\"\u003eGroup\u003c/a\u003e                   /         \\           \\\n                         (\u003ca href=\"#invert\"\u003einvert\u003c/a\u003e)               \u003ca href=\"#Alt\"\u003eAlt\u003c/a\u003e        \u003ca href=\"#Apply\"\u003eApply\u003c/a\u003e      \u003ca href=\"#Extend\"\u003eExtend\u003c/a\u003e\n                                               (\u003ca href=\"#alt\"\u003ealt\u003c/a\u003e)        (\u003ca href=\"#ap\"\u003eap\u003c/a\u003e)     (\u003ca href=\"#extend\"\u003eextend\u003c/a\u003e)\n                                                /           / \\           \\\n                                               /           /   \\           \\\n                                              /           /     \\           \\\n                                             /           /       \\           \\\n                                            /           /         \\           \\\n                                          \u003ca href=\"#Plus\"\u003ePlus\u003c/a\u003e    \u003ca href=\"#Applicative\"\u003eApplicative\u003c/a\u003e    \u003ca href=\"#Chain\"\u003eChain\u003c/a\u003e      \u003ca href=\"#Comonad\"\u003eComonad\u003c/a\u003e\n                                         (\u003ca href=\"#zero\"\u003ezero\u003c/a\u003e)       (\u003ca href=\"#of\"\u003eof\u003c/a\u003e)      (\u003ca href=\"#chain\"\u003echain\u003c/a\u003e)    (\u003ca href=\"#extract\"\u003eextract\u003c/a\u003e)\n                                            \\         / \\         / \\\n                                             \\       /   \\       /   \\\n                                              \\     /     \\     /     \\\n                                               \\   /       \\   /       \\\n                                                \\ /         \\ /         \\\n                                            \u003ca href=\"#Alternative\"\u003eAlternative\u003c/a\u003e    \u003ca href=\"#Monad\"\u003eMonad\u003c/a\u003e     \u003ca href=\"#ChainRec\"\u003eChainRec\u003c/a\u003e\n                                                                    (\u003ca href=\"#chainRec\"\u003echainRec\u003c/a\u003e)\n\u003c/pre\u003e\n\n## API\n\n#### \u003ca name=\"TypeClass\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L609\"\u003e`TypeClass :: (String, String, Array TypeClass, a -⁠\u003e Boolean) -⁠\u003e TypeClass`\u003c/a\u003e\n\nThe arguments are:\n\n  - the name of the type class, prefixed by its npm package name;\n  - the documentation URL of the type class;\n  - an array of dependencies; and\n  - a predicate which accepts any JavaScript value and returns `true`\n    if the value satisfies the requirements of the type class; `false`\n    otherwise.\n\nExample:\n\n```javascript\n//    hasMethod :: String -\u003e a -\u003e Boolean\nconst hasMethod = name =\u003e x =\u003e x != null \u0026\u0026 typeof x[name] == 'function';\n\n//    Foo :: TypeClass\nconst Foo = Z.TypeClass (\n  'my-package/Foo',\n  'http://example.com/my-package#Foo',\n  [],\n  hasMethod ('foo')\n);\n\n//    Bar :: TypeClass\nconst Bar = Z.TypeClass (\n  'my-package/Bar',\n  'http://example.com/my-package#Bar',\n  [Foo],\n  hasMethod ('bar')\n);\n```\n\nTypes whose values have a `foo` method are members of the Foo type class.\nMembers of the Foo type class whose values have a `bar` method are also\nmembers of the Bar type class.\n\nEach `TypeClass` value has a `test` field: a function which accepts\nany JavaScript value and returns `true` if the value satisfies the\ntype class's predicate and the predicates of all the type class's\ndependencies; `false` otherwise.\n\n`TypeClass` values may be used with [sanctuary-def][type-classes]\nto define parametrically polymorphic functions which verify their\ntype-class constraints at run time.\n\n#### \u003ca name=\"Setoid\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L740\"\u003e`Setoid :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Setoid][].\n\n```javascript\n\u003e Z.Setoid.test (null)\ntrue\n\n\u003e Z.Setoid.test (Useless)\nfalse\n\n\u003e Z.Setoid.test ([1, 2, 3])\ntrue\n\n\u003e Z.Setoid.test ([Useless])\nfalse\n```\n\n#### \u003ca name=\"Ord\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L777\"\u003e`Ord :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Ord][].\n\n```javascript\n\u003e Z.Ord.test (0)\ntrue\n\n\u003e Z.Ord.test (Math.sqrt)\nfalse\n\n\u003e Z.Ord.test ([1, 2, 3])\ntrue\n\n\u003e Z.Ord.test ([Math.sqrt])\nfalse\n```\n\n#### \u003ca name=\"Semigroupoid\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L811\"\u003e`Semigroupoid :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Semigroupoid][].\n\n```javascript\n\u003e Z.Semigroupoid.test (Math.sqrt)\ntrue\n\n\u003e Z.Semigroupoid.test (0)\nfalse\n```\n\n#### \u003ca name=\"Category\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L831\"\u003e`Category :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Category][].\n\n```javascript\n\u003e Z.Category.test (Math.sqrt)\ntrue\n\n\u003e Z.Category.test (0)\nfalse\n```\n\n#### \u003ca name=\"Semigroup\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L851\"\u003e`Semigroup :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Semigroup][].\n\n```javascript\n\u003e Z.Semigroup.test ('')\ntrue\n\n\u003e Z.Semigroup.test (0)\nfalse\n```\n\n#### \u003ca name=\"Monoid\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L873\"\u003e`Monoid :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Monoid][].\n\n```javascript\n\u003e Z.Monoid.test ('')\ntrue\n\n\u003e Z.Monoid.test (0)\nfalse\n```\n\n#### \u003ca name=\"Group\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L895\"\u003e`Group :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Group][].\n\n```javascript\n\u003e Z.Group.test (Sum (0))\ntrue\n\n\u003e Z.Group.test ('')\nfalse\n```\n\n#### \u003ca name=\"Filterable\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L913\"\u003e`Filterable :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Filterable][].\n\n```javascript\n\u003e Z.Filterable.test ({})\ntrue\n\n\u003e Z.Filterable.test ('')\nfalse\n```\n\n#### \u003ca name=\"Functor\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L934\"\u003e`Functor :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Functor][].\n\n```javascript\n\u003e Z.Functor.test ([])\ntrue\n\n\u003e Z.Functor.test ('')\nfalse\n```\n\n#### \u003ca name=\"Bifunctor\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L956\"\u003e`Bifunctor :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Bifunctor][].\n\n```javascript\n\u003e Z.Bifunctor.test (Pair ('foo') (64))\ntrue\n\n\u003e Z.Bifunctor.test ([])\nfalse\n```\n\n#### \u003ca name=\"Profunctor\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L974\"\u003e`Profunctor :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Profunctor][].\n\n```javascript\n\u003e Z.Profunctor.test (Math.sqrt)\ntrue\n\n\u003e Z.Profunctor.test ([])\nfalse\n```\n\n#### \u003ca name=\"Apply\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L994\"\u003e`Apply :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Apply][].\n\n```javascript\n\u003e Z.Apply.test ([])\ntrue\n\n\u003e Z.Apply.test ('')\nfalse\n```\n\n#### \u003ca name=\"Applicative\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1016\"\u003e`Applicative :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Applicative][].\n\n```javascript\n\u003e Z.Applicative.test ([])\ntrue\n\n\u003e Z.Applicative.test ({})\nfalse\n```\n\n#### \u003ca name=\"Chain\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1037\"\u003e`Chain :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Chain][].\n\n```javascript\n\u003e Z.Chain.test ([])\ntrue\n\n\u003e Z.Chain.test ({})\nfalse\n```\n\n#### \u003ca name=\"ChainRec\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1058\"\u003e`ChainRec :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [ChainRec][].\n\n```javascript\n\u003e Z.ChainRec.test ([])\ntrue\n\n\u003e Z.ChainRec.test ({})\nfalse\n```\n\n#### \u003ca name=\"Monad\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1079\"\u003e`Monad :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Monad][].\n\n```javascript\n\u003e Z.Monad.test ([])\ntrue\n\n\u003e Z.Monad.test ({})\nfalse\n```\n\n#### \u003ca name=\"Alt\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1092\"\u003e`Alt :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Alt][].\n\n```javascript\n\u003e Z.Alt.test ({})\ntrue\n\n\u003e Z.Alt.test ('')\nfalse\n```\n\n#### \u003ca name=\"Plus\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1113\"\u003e`Plus :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Plus][].\n\n```javascript\n\u003e Z.Plus.test ({})\ntrue\n\n\u003e Z.Plus.test ('')\nfalse\n```\n\n#### \u003ca name=\"Alternative\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1134\"\u003e`Alternative :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Alternative][].\n\n```javascript\n\u003e Z.Alternative.test ([])\ntrue\n\n\u003e Z.Alternative.test ({})\nfalse\n```\n\n#### \u003ca name=\"Foldable\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1147\"\u003e`Foldable :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Foldable][].\n\n```javascript\n\u003e Z.Foldable.test ({})\ntrue\n\n\u003e Z.Foldable.test ('')\nfalse\n```\n\n#### \u003ca name=\"Traversable\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1168\"\u003e`Traversable :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Traversable][].\n\n```javascript\n\u003e Z.Traversable.test ([])\ntrue\n\n\u003e Z.Traversable.test ('')\nfalse\n```\n\n#### \u003ca name=\"Extend\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1189\"\u003e`Extend :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Extend][].\n\n```javascript\n\u003e Z.Extend.test ([])\ntrue\n\n\u003e Z.Extend.test ({})\nfalse\n```\n\n#### \u003ca name=\"Comonad\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1210\"\u003e`Comonad :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Comonad][].\n\n```javascript\n\u003e Z.Comonad.test (Identity (0))\ntrue\n\n\u003e Z.Comonad.test ([])\nfalse\n```\n\n#### \u003ca name=\"Contravariant\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1228\"\u003e`Contravariant :: TypeClass`\u003c/a\u003e\n\n`TypeClass` value for [Contravariant][].\n\n```javascript\n\u003e Z.Contravariant.test (Math.sqrt)\ntrue\n\n\u003e Z.Contravariant.test ([])\nfalse\n```\n\n#### \u003ca name=\"equals\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1248\"\u003e`equals :: (a, b) -⁠\u003e Boolean`\u003c/a\u003e\n\nReturns `true` if its arguments are equal; `false` otherwise.\n\nSpecifically:\n\n  - Arguments with different [type identities][] are unequal.\n\n  - If the first argument has a [`fantasy-land/equals`][] method,\n    that method is invoked to determine whether the arguments are\n    equal (`fantasy-land/equals` implementations are provided for the\n    following built-in types: Null, Undefined, Boolean, Number, Date,\n    RegExp, String, Array, Arguments, Error, Object, and Function).\n\n  - Otherwise, the arguments are equal if their\n    [entries][`Object.entries`] are equal (according to this algorithm).\n\nThe algorithm supports circular data structures. Two arrays are equal\nif they have the same index paths and for each path have equal values.\nTwo arrays which represent `[1, [1, [1, [1, [1, ...]]]]]`, for example,\nare equal even if their internal structures differ. Two objects are equal\nif they have the same property paths and for each path have equal values.\n\n```javascript\n\u003e Z.equals (0, -0)\ntrue\n\n\u003e Z.equals (NaN, NaN)\ntrue\n\n\u003e Z.equals (Cons (1, Cons (2, Nil)), Cons (1, Cons (2, Nil)))\ntrue\n\n\u003e Z.equals (Cons (1, Cons (2, Nil)), Cons (2, Cons (1, Nil)))\nfalse\n```\n\n#### \u003ca name=\"lt\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1308\"\u003e`lt :: (a, b) -⁠\u003e Boolean`\u003c/a\u003e\n\nReturns `true` if its arguments are of the same type and the first is\nless than the second according to the type's [`fantasy-land/lte`][]\nmethod; `false` otherwise.\n\nThis function is derived from [`lte`](#lte).\n\nSee also [`gt`](#gt) and [`gte`](#gte).\n\n```javascript\n\u003e Z.lt (0, 0)\nfalse\n\n\u003e Z.lt (0, 1)\ntrue\n\n\u003e Z.lt (1, 0)\nfalse\n```\n\n#### \u003ca name=\"lte\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1330\"\u003e`lte :: (a, b) -⁠\u003e Boolean`\u003c/a\u003e\n\nReturns `true` if its arguments are of the same type and the first\nis less than or equal to the second according to the type's\n[`fantasy-land/lte`][] method; `false` otherwise.\n\n`fantasy-land/lte` implementations are provided for the following\nbuilt-in types: Null, Undefined, Boolean, Number, Date, String, Array,\nArguments, and Object.\n\nThe algorithm supports circular data structures in the same manner as\n[`equals`](#equals).\n\nSee also [`lt`](#lt), [`gt`](#gt), and [`gte`](#gte).\n\n```javascript\n\u003e Z.lte (0, 0)\ntrue\n\n\u003e Z.lte (0, 1)\ntrue\n\n\u003e Z.lte (1, 0)\nfalse\n```\n\n#### \u003ca name=\"gt\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1377\"\u003e`gt :: (a, b) -⁠\u003e Boolean`\u003c/a\u003e\n\nReturns `true` if its arguments are of the same type and the first is\ngreater than the second according to the type's [`fantasy-land/lte`][]\nmethod; `false` otherwise.\n\nThis function is derived from [`lte`](#lte).\n\nSee also [`lt`](#lt) and [`gte`](#gte).\n\n```javascript\n\u003e Z.gt (0, 0)\nfalse\n\n\u003e Z.gt (0, 1)\nfalse\n\n\u003e Z.gt (1, 0)\ntrue\n```\n\n#### \u003ca name=\"gte\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1399\"\u003e`gte :: (a, b) -⁠\u003e Boolean`\u003c/a\u003e\n\nReturns `true` if its arguments are of the same type and the first\nis greater than or equal to the second according to the type's\n[`fantasy-land/lte`][] method; `false` otherwise.\n\nThis function is derived from [`lte`](#lte).\n\nSee also [`lt`](#lt) and [`gt`](#gt).\n\n```javascript\n\u003e Z.gte (0, 0)\ntrue\n\n\u003e Z.gte (0, 1)\nfalse\n\n\u003e Z.gte (1, 0)\ntrue\n```\n\n#### \u003ca name=\"min\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1421\"\u003e`min :: Ord a =\u003e (a, a) -⁠\u003e a`\u003c/a\u003e\n\nReturns the smaller of its two arguments.\n\nThis function is derived from [`lte`](#lte).\n\nSee also [`max`](#max).\n\n```javascript\n\u003e Z.min (10, 2)\n2\n\n\u003e Z.min (new Date ('1999-12-31'), new Date ('2000-01-01'))\nnew Date ('1999-12-31')\n\n\u003e Z.min ('10', '2')\n'10'\n```\n\n#### \u003ca name=\"max\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1441\"\u003e`max :: Ord a =\u003e (a, a) -⁠\u003e a`\u003c/a\u003e\n\nReturns the larger of its two arguments.\n\nThis function is derived from [`lte`](#lte).\n\nSee also [`min`](#min).\n\n```javascript\n\u003e Z.max (10, 2)\n10\n\n\u003e Z.max (new Date ('1999-12-31'), new Date ('2000-01-01'))\nnew Date ('2000-01-01')\n\n\u003e Z.max ('10', '2')\n'2'\n```\n\n#### \u003ca name=\"clamp\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1461\"\u003e`clamp :: Ord a =\u003e (a, a, a) -⁠\u003e a`\u003c/a\u003e\n\nTakes a lower bound, an upper bound, and a value of the same type.\nReturns the value if it is within the bounds; the nearer bound otherwise.\n\nThis function is derived from [`min`](#min) and [`max`](#max).\n\n```javascript\n\u003e Z.clamp (0, 100, 42)\n42\n\n\u003e Z.clamp (0, 100, -1)\n0\n\n\u003e Z.clamp ('A', 'Z', '~')\n'Z'\n```\n\n#### \u003ca name=\"compose\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1480\"\u003e`compose :: Semigroupoid c =\u003e (c j k, c i j) -⁠\u003e c i k`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/compose`][].\n\n`fantasy-land/compose` implementations are provided for the following\nbuilt-in types: Function.\n\n```javascript\n\u003e Z.compose (Math.sqrt, x =\u003e x + 1) (99)\n10\n```\n\n#### \u003ca name=\"id\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1493\"\u003e`id :: Category c =\u003e TypeRep c -⁠\u003e c`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/id`][].\n\n`fantasy-land/id` implementations are provided for the following\nbuilt-in types: Function.\n\n```javascript\n\u003e Z.id (Function) ('foo')\n'foo'\n```\n\n#### \u003ca name=\"concat\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1506\"\u003e`concat :: Semigroup a =\u003e (a, a) -⁠\u003e a`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/concat`][].\n\n`fantasy-land/concat` implementations are provided for the following\nbuilt-in types: String, Array, and Object.\n\n```javascript\n\u003e Z.concat ('abc', 'def')\n'abcdef'\n\n\u003e Z.concat ([1, 2, 3], [4, 5, 6])\n[1, 2, 3, 4, 5, 6]\n\n\u003e Z.concat ({x: 1, y: 2}, {y: 3, z: 4})\n{x: 1, y: 3, z: 4}\n\n\u003e Z.concat (Cons ('foo', Cons ('bar', Cons ('baz', Nil))), Cons ('quux', Nil))\nCons ('foo', Cons ('bar', Cons ('baz', Cons ('quux', Nil))))\n```\n\n#### \u003ca name=\"empty\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1528\"\u003e`empty :: Monoid m =\u003e TypeRep m -⁠\u003e m`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/empty`][].\n\n`fantasy-land/empty` implementations are provided for the following\nbuilt-in types: String, Array, and Object.\n\n```javascript\n\u003e Z.empty (String)\n''\n\n\u003e Z.empty (Array)\n[]\n\n\u003e Z.empty (Object)\n{}\n\n\u003e Z.empty (List)\nNil\n```\n\n#### \u003ca name=\"invert\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1550\"\u003e`invert :: Group g =\u003e g -⁠\u003e g`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/invert`][].\n\n```javascript\n\u003e Z.invert (Sum (5))\nSum (-5)\n```\n\n#### \u003ca name=\"filter\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1560\"\u003e`filter :: Filterable f =\u003e (a -⁠\u003e Boolean, f a) -⁠\u003e f a`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/filter`][]. Discards every element\nwhich does not satisfy the predicate.\n\n`fantasy-land/filter` implementations are provided for the following\nbuilt-in types: Array and Object.\n\nSee also [`reject`](#reject).\n\n```javascript\n\u003e Z.filter (x =\u003e x % 2 == 1, [1, 2, 3])\n[1, 3]\n\n\u003e Z.filter (x =\u003e x % 2 == 1, {x: 1, y: 2, z: 3})\n{x: 1, z: 3}\n\n\u003e Z.filter (x =\u003e x % 2 == 1, Cons (1, Cons (2, Cons (3, Nil))))\nCons (1, Cons (3, Nil))\n\n\u003e Z.filter (x =\u003e x % 2 == 1, Nothing)\nNothing\n\n\u003e Z.filter (x =\u003e x % 2 == 1, Just (0))\nNothing\n\n\u003e Z.filter (x =\u003e x % 2 == 1, Just (1))\nJust (1)\n```\n\n#### \u003ca name=\"reject\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1591\"\u003e`reject :: Filterable f =\u003e (a -⁠\u003e Boolean, f a) -⁠\u003e f a`\u003c/a\u003e\n\nDiscards every element which satisfies the predicate.\n\nThis function is derived from [`filter`](#filter).\n\n```javascript\n\u003e Z.reject (x =\u003e x % 2 == 1, [1, 2, 3])\n[2]\n\n\u003e Z.reject (x =\u003e x % 2 == 1, {x: 1, y: 2, z: 3})\n{y: 2}\n\n\u003e Z.reject (x =\u003e x % 2 == 1, Cons (1, Cons (2, Cons (3, Nil))))\nCons (2, Nil)\n\n\u003e Z.reject (x =\u003e x % 2 == 1, Nothing)\nNothing\n\n\u003e Z.reject (x =\u003e x % 2 == 1, Just (0))\nJust (0)\n\n\u003e Z.reject (x =\u003e x % 2 == 1, Just (1))\nNothing\n```\n\n#### \u003ca name=\"map\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1618\"\u003e`map :: Functor f =\u003e (a -⁠\u003e b, f a) -⁠\u003e f b`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/map`][].\n\n`fantasy-land/map` implementations are provided for the following\nbuilt-in types: Array, Object, and Function.\n\n```javascript\n\u003e Z.map (Math.sqrt, [1, 4, 9])\n[1, 2, 3]\n\n\u003e Z.map (Math.sqrt, {x: 1, y: 4, z: 9})\n{x: 1, y: 2, z: 3}\n\n\u003e Z.map (Math.sqrt, s =\u003e s.length) ('Sanctuary')\n3\n\n\u003e Z.map (Math.sqrt, Pair ('foo') (64))\nPair ('foo') (8)\n\n\u003e Z.map (Math.sqrt, Nil)\nNil\n\n\u003e Z.map (Math.sqrt, Cons (1, Cons (4, Cons (9, Nil))))\nCons (1, Cons (2, Cons (3, Nil)))\n```\n\n#### \u003ca name=\"flip\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1646\"\u003e`flip :: Functor f =\u003e (f (a -⁠\u003e b), a) -⁠\u003e f b`\u003c/a\u003e\n\nMaps over the given functions, applying each to the given value.\n\nThis function is derived from [`map`](#map).\n\n```javascript\n\u003e Z.flip (x =\u003e y =\u003e x + y, '!') ('foo')\n'foo!'\n\n\u003e Z.flip ([Math.floor, Math.ceil], 1.5)\n[1, 2]\n\n\u003e Z.flip ({floor: Math.floor, ceil: Math.ceil}, 1.5)\n{floor: 1, ceil: 2}\n\n\u003e Z.flip (Cons (Math.floor, Cons (Math.ceil, Nil)), 1.5)\nCons (1, Cons (2, Nil))\n```\n\n#### \u003ca name=\"bimap\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1667\"\u003e`bimap :: Bifunctor f =\u003e (a -⁠\u003e b, c -⁠\u003e d, f a c) -⁠\u003e f b d`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/bimap`][].\n\n```javascript\n\u003e Z.bimap (s =\u003e s.toUpperCase (), Math.sqrt, Pair ('foo') (64))\nPair ('FOO') (8)\n```\n\n#### \u003ca name=\"mapLeft\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1677\"\u003e`mapLeft :: Bifunctor f =\u003e (a -⁠\u003e b, f a c) -⁠\u003e f b c`\u003c/a\u003e\n\nMaps the given function over the left side of a Bifunctor.\n\n```javascript\n\u003e Z.mapLeft (Math.sqrt, Pair (64) (9))\nPair (8) (9)\n```\n\n#### \u003ca name=\"promap\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1687\"\u003e`promap :: Profunctor p =\u003e (a -⁠\u003e b, c -⁠\u003e d, p b c) -⁠\u003e p a d`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/promap`][].\n\n`fantasy-land/promap` implementations are provided for the following\nbuilt-in types: Function.\n\n```javascript\n\u003e Z.promap (Math.abs, x =\u003e x + 1, Math.sqrt) (-100)\n11\n```\n\n#### \u003ca name=\"ap\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1700\"\u003e`ap :: Apply f =\u003e (f (a -⁠\u003e b), f a) -⁠\u003e f b`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/ap`][].\n\n`fantasy-land/ap` implementations are provided for the following\nbuilt-in types: Array, Object, and Function.\n\n```javascript\n\u003e Z.ap ([Math.sqrt, x =\u003e x * x], [1, 4, 9, 16, 25])\n[1, 2, 3, 4, 5, 1, 16, 81, 256, 625]\n\n\u003e Z.ap ({a: Math.sqrt, b: x =\u003e x * x}, {a: 16, b: 10, c: 1})\n{a: 4, b: 100}\n\n\u003e Z.ap (s =\u003e n =\u003e s.slice (0, n), s =\u003e Math.ceil (s.length / 2)) ('Haskell')\n'Hask'\n\n\u003e Z.ap (Identity (Math.sqrt), Identity (64))\nIdentity (8)\n\n\u003e Z.ap (Cons (Math.sqrt, Cons (x =\u003e x * x, Nil)), Cons (16, Cons (100, Nil)))\nCons (4, Cons (10, Cons (256, Cons (10000, Nil))))\n```\n\n#### \u003ca name=\"lift2\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1725\"\u003e`lift2 :: Apply f =\u003e (a -⁠\u003e b -⁠\u003e c, f a, f b) -⁠\u003e f c`\u003c/a\u003e\n\nLifts `a -\u003e b -\u003e c` to `Apply f =\u003e f a -\u003e f b -\u003e f c` and returns the\nresult of applying this to the given arguments.\n\nThis function is derived from [`map`](#map) and [`ap`](#ap).\n\nSee also [`lift3`](#lift3).\n\n```javascript\n\u003e Z.lift2 (x =\u003e y =\u003e Math.pow (x, y), [10], [1, 2, 3])\n[10, 100, 1000]\n\n\u003e Z.lift2 (x =\u003e y =\u003e Math.pow (x, y), Identity (10), Identity (3))\nIdentity (1000)\n```\n\n#### \u003ca name=\"lift3\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1743\"\u003e`lift3 :: Apply f =\u003e (a -⁠\u003e b -⁠\u003e c -⁠\u003e d, f a, f b, f c) -⁠\u003e f d`\u003c/a\u003e\n\nLifts `a -\u003e b -\u003e c -\u003e d` to `Apply f =\u003e f a -\u003e f b -\u003e f c -\u003e f d` and\nreturns the result of applying this to the given arguments.\n\nThis function is derived from [`map`](#map) and [`ap`](#ap).\n\nSee also [`lift2`](#lift2).\n\n```javascript\n\u003e Z.lift3 (x =\u003e y =\u003e z =\u003e x + z + y,\n.          ['\u003c', '['],\n.          ['\u003e', ']'],\n.          ['foo', 'bar', 'baz'])\n[ '\u003cfoo\u003e', '\u003cbar\u003e', '\u003cbaz\u003e',\n. '\u003cfoo]', '\u003cbar]', '\u003cbaz]',\n. '[foo\u003e', '[bar\u003e', '[baz\u003e',\n. '[foo]', '[bar]', '[baz]' ]\n\n\u003e Z.lift3 (x =\u003e y =\u003e z =\u003e x + z + y,\n.          Identity ('\u003c'),\n.          Identity ('\u003e'),\n.          Identity ('baz'))\nIdentity ('\u003cbaz\u003e')\n```\n\n#### \u003ca name=\"apFirst\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1770\"\u003e`apFirst :: Apply f =\u003e (f a, f b) -⁠\u003e f a`\u003c/a\u003e\n\nCombines two effectful actions, keeping only the result of the first.\nEquivalent to Haskell's `(\u003c*)` function.\n\nThis function is derived from [`lift2`](#lift2).\n\nSee also [`apSecond`](#apSecond).\n\n```javascript\n\u003e Z.apFirst ([1, 2], [3, 4])\n[1, 1, 2, 2]\n\n\u003e Z.apFirst (Identity (1), Identity (2))\nIdentity (1)\n```\n\n#### \u003ca name=\"apSecond\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1788\"\u003e`apSecond :: Apply f =\u003e (f a, f b) -⁠\u003e f b`\u003c/a\u003e\n\nCombines two effectful actions, keeping only the result of the second.\nEquivalent to Haskell's `(*\u003e)` function.\n\nThis function is derived from [`lift2`](#lift2).\n\nSee also [`apFirst`](#apFirst).\n\n```javascript\n\u003e Z.apSecond ([1, 2], [3, 4])\n[3, 4, 3, 4]\n\n\u003e Z.apSecond (Identity (1), Identity (2))\nIdentity (2)\n```\n\n#### \u003ca name=\"of\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1806\"\u003e`of :: Applicative f =\u003e (TypeRep f, a) -⁠\u003e f a`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/of`][].\n\n`fantasy-land/of` implementations are provided for the following\nbuilt-in types: Array and Function.\n\n```javascript\n\u003e Z.of (Array, 42)\n[42]\n\n\u003e Z.of (Function, 42) (null)\n42\n\n\u003e Z.of (List, 42)\nCons (42, Nil)\n```\n\n#### \u003ca name=\"append\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1825\"\u003e`append :: (Applicative f, Semigroup (f a)) =\u003e (a, f a) -⁠\u003e f a`\u003c/a\u003e\n\nReturns the result of appending the first argument to the second.\n\nThis function is derived from [`concat`](#concat) and [`of`](#of).\n\nSee also [`prepend`](#prepend).\n\n```javascript\n\u003e Z.append (3, [1, 2])\n[1, 2, 3]\n\n\u003e Z.append (3, Cons (1, Cons (2, Nil)))\nCons (1, Cons (2, Cons (3, Nil)))\n```\n\n#### \u003ca name=\"prepend\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1842\"\u003e`prepend :: (Applicative f, Semigroup (f a)) =\u003e (a, f a) -⁠\u003e f a`\u003c/a\u003e\n\nReturns the result of prepending the first argument to the second.\n\nThis function is derived from [`concat`](#concat) and [`of`](#of).\n\nSee also [`append`](#append).\n\n```javascript\n\u003e Z.prepend (1, [2, 3])\n[1, 2, 3]\n\n\u003e Z.prepend (1, Cons (2, Cons (3, Nil)))\nCons (1, Cons (2, Cons (3, Nil)))\n```\n\n#### \u003ca name=\"chain\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1859\"\u003e`chain :: Chain m =\u003e (a -⁠\u003e m b, m a) -⁠\u003e m b`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/chain`][].\n\n`fantasy-land/chain` implementations are provided for the following\nbuilt-in types: Array and Function.\n\n```javascript\n\u003e Z.chain (x =\u003e [x, x], [1, 2, 3])\n[1, 1, 2, 2, 3, 3]\n\n\u003e Z.chain (x =\u003e x % 2 == 1 ? Z.of (List, x) : Nil,\n.          Cons (1, Cons (2, Cons (3, Nil))))\nCons (1, Cons (3, Nil))\n\n\u003e Z.chain (n =\u003e s =\u003e s.slice (0, n),\n.          s =\u003e Math.ceil (s.length / 2))\n.         ('Haskell')\n'Hask'\n```\n\n#### \u003ca name=\"join\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1881\"\u003e`join :: Chain m =\u003e m (m a) -⁠\u003e m a`\u003c/a\u003e\n\nRemoves one level of nesting from a nested monadic structure.\n\nThis function is derived from [`chain`](#chain).\n\n```javascript\n\u003e Z.join ([[1], [2], [3]])\n[1, 2, 3]\n\n\u003e Z.join ([[[1, 2, 3]]])\n[[1, 2, 3]]\n\n\u003e Z.join (Identity (Identity (1)))\nIdentity (1)\n```\n\n#### \u003ca name=\"chainRec\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1899\"\u003e`chainRec :: ChainRec m =\u003e (TypeRep m, (a -⁠\u003e c, b -⁠\u003e c, a) -⁠\u003e m c, a) -⁠\u003e m b`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/chainRec`][].\n\n`fantasy-land/chainRec` implementations are provided for the following\nbuilt-in types: Array.\n\n```javascript\n\u003e Z.chainRec (\n.   Array,\n.   (next, done, s) =\u003e s.length == 2 ? [s + '!', s + '?'].map (done)\n.                                    : [s + 'o', s + 'n'].map (next),\n.   ''\n. )\n['oo!', 'oo?', 'on!', 'on?', 'no!', 'no?', 'nn!', 'nn?']\n```\n\n#### \u003ca name=\"alt\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1917\"\u003e`alt :: Alt f =\u003e (f a, f a) -⁠\u003e f a`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/alt`][].\n\n`fantasy-land/alt` implementations are provided for the following\nbuilt-in types: Array and Object.\n\n```javascript\n\u003e Z.alt ([1, 2, 3], [4, 5, 6])\n[1, 2, 3, 4, 5, 6]\n\n\u003e Z.alt (Nothing, Nothing)\nNothing\n\n\u003e Z.alt (Nothing, Just (1))\nJust (1)\n\n\u003e Z.alt (Just (2), Just (3))\nJust (2)\n```\n\n#### \u003ca name=\"zero\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1939\"\u003e`zero :: Plus f =\u003e TypeRep f -⁠\u003e f a`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/zero`][].\n\n`fantasy-land/zero` implementations are provided for the following\nbuilt-in types: Array and Object.\n\n```javascript\n\u003e Z.zero (Array)\n[]\n\n\u003e Z.zero (Object)\n{}\n\n\u003e Z.zero (Maybe)\nNothing\n```\n\n#### \u003ca name=\"reduce\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1958\"\u003e`reduce :: Foldable f =\u003e ((b, a) -⁠\u003e b, b, f a) -⁠\u003e b`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/reduce`][].\n\n`fantasy-land/reduce` implementations are provided for the following\nbuilt-in types: Array and Object.\n\n```javascript\n\u003e Z.reduce ((xs, x) =\u003e [x].concat (xs), [], [1, 2, 3])\n[3, 2, 1]\n\n\u003e Z.reduce (Z.concat, '', Cons ('foo', Cons ('bar', Cons ('baz', Nil))))\n'foobarbaz'\n\n\u003e Z.reduce (Z.concat, '', {foo: 'x', bar: 'y', baz: 'z'})\n'yzx'\n```\n\n#### \u003ca name=\"size\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L1977\"\u003e`size :: Foldable f =\u003e f a -⁠\u003e Integer`\u003c/a\u003e\n\nReturns the number of elements of the given structure.\n\nThis function is derived from [`reduce`](#reduce).\n\n```javascript\n\u003e Z.size ([])\n0\n\n\u003e Z.size (['foo', 'bar', 'baz'])\n3\n\n\u003e Z.size (Nil)\n0\n\n\u003e Z.size (Cons ('foo', Cons ('bar', Cons ('baz', Nil))))\n3\n```\n\n#### \u003ca name=\"all\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2002\"\u003e`all :: Foldable f =\u003e (a -⁠\u003e Boolean, f a) -⁠\u003e Boolean`\u003c/a\u003e\n\nReturns `true` if all the elements of the structure satisfy the\npredicate; `false` otherwise.\n\nThis function is derived from [`reduce`](#reduce).\n\nSee also [`any`](#any) and [`none`](#none).\n\n```javascript\n\u003e Z.all (Number.isInteger, [])\ntrue\n\n\u003e Z.all (Number.isInteger, [1, 2, 3])\ntrue\n\n\u003e Z.all (Number.isInteger, [0, 0.25, 0.5, 0.75, 1])\nfalse\n```\n\n#### \u003ca name=\"any\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2027\"\u003e`any :: Foldable f =\u003e (a -⁠\u003e Boolean, f a) -⁠\u003e Boolean`\u003c/a\u003e\n\nReturns `true` if any element of the structure satisfies the predicate;\n`false` otherwise.\n\nThis function is derived from [`reduce`](#reduce).\n\nSee also [`all`](#all) and [`none`](#none).\n\n```javascript\n\u003e Z.any (Number.isInteger, [])\nfalse\n\n\u003e Z.any (Number.isInteger, [1, 2, 3])\ntrue\n\n\u003e Z.any (Number.isInteger, [0, 0.25, 0.5, 0.75, 1])\ntrue\n```\n\n#### \u003ca name=\"none\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2052\"\u003e`none :: Foldable f =\u003e (a -⁠\u003e Boolean, f a) -⁠\u003e Boolean`\u003c/a\u003e\n\nReturns `true` if none of the elements of the structure satisfies the\npredicate; `false` otherwise.\n\nThis function is derived from [`any`](#any). `Z.none (pred, foldable)` is\nequivalent to `!(Z.any (pred, foldable))`.\n\nSee also [`all`](#all).\n\n```javascript\n\u003e Z.none (Number.isInteger, [])\ntrue\n\n\u003e Z.none (Number.isInteger, [0, 0.25, 0.5, 0.75, 1])\nfalse\n```\n\n#### \u003ca name=\"elem\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2071\"\u003e`elem :: (Setoid a, Foldable f) =\u003e (a, f a) -⁠\u003e Boolean`\u003c/a\u003e\n\nTakes a value and a structure and returns `true` if the\nvalue is an element of the structure; `false` otherwise.\n\nThis function is derived from [`equals`](#equals) and\n[`reduce`](#reduce).\n\n```javascript\n\u003e Z.elem ('c', ['a', 'b', 'c'])\ntrue\n\n\u003e Z.elem ('x', ['a', 'b', 'c'])\nfalse\n\n\u003e Z.elem (3, {x: 1, y: 2, z: 3})\ntrue\n\n\u003e Z.elem (8, {x: 1, y: 2, z: 3})\nfalse\n\n\u003e Z.elem (0, Just (0))\ntrue\n\n\u003e Z.elem (0, Just (1))\nfalse\n\n\u003e Z.elem (0, Nothing)\nfalse\n```\n\n#### \u003ca name=\"intercalate\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2103\"\u003e`intercalate :: (Monoid m, Foldable f) =\u003e (m, f m) -⁠\u003e m`\u003c/a\u003e\n\nConcatenates the elements of the given structure, separating each pair\nof adjacent elements with the given separator.\n\nThis function is derived from [`concat`](#concat), [`empty`](#empty),\nand [`reduce`](#reduce).\n\n```javascript\n\u003e Z.intercalate (', ', [])\n''\n\n\u003e Z.intercalate (', ', ['foo', 'bar', 'baz'])\n'foo, bar, baz'\n\n\u003e Z.intercalate (', ', Nil)\n''\n\n\u003e Z.intercalate (', ', Cons ('foo', Cons ('bar', Cons ('baz', Nil))))\n'foo, bar, baz'\n\n\u003e Z.intercalate ([0, 0, 0], [])\n[]\n\n\u003e Z.intercalate ([0, 0, 0], [[1], [2, 3], [4, 5, 6], [7, 8], [9]])\n[1, 0, 0, 0, 2, 3, 0, 0, 0, 4, 5, 6, 0, 0, 0, 7, 8, 0, 0, 0, 9]\n```\n\n#### \u003ca name=\"foldMap\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2142\"\u003e`foldMap :: (Monoid m, Foldable f) =\u003e (TypeRep m, a -⁠\u003e m, f a) -⁠\u003e m`\u003c/a\u003e\n\nDeconstructs a foldable by mapping every element to a monoid and\nconcatenating the results.\n\nThis function is derived from [`concat`](#concat), [`empty`](#empty),\nand [`reduce`](#reduce).\n\n```javascript\n\u003e Z.foldMap (String, f =\u003e f.name, [Math.sin, Math.cos, Math.tan])\n'sincostan'\n```\n\n#### \u003ca name=\"reverse\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2162\"\u003e`reverse :: (Applicative f, Foldable f, Monoid (f a)) =\u003e f a -⁠\u003e f a`\u003c/a\u003e\n\nReverses the elements of the given structure.\n\nThis function is derived from [`concat`](#concat), [`empty`](#empty),\n[`of`](#of), and [`reduce`](#reduce).\n\n```javascript\n\u003e Z.reverse ([1, 2, 3])\n[3, 2, 1]\n\n\u003e Z.reverse (Cons (1, Cons (2, Cons (3, Nil))))\nCons (3, Cons (2, Cons (1, Nil)))\n```\n\n#### \u003ca name=\"sort\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2187\"\u003e`sort :: (Ord a, Applicative f, Foldable f, Monoid (f a)) =\u003e f a -⁠\u003e f a`\u003c/a\u003e\n\nPerforms a [stable sort][] of the elements of the given structure,\nusing [`lte`](#lte) for comparisons.\n\nThis function is derived from [`lte`](#lte), [`concat`](#concat),\n[`empty`](#empty), [`of`](#of), and [`reduce`](#reduce).\n\nSee also [`sortBy`](#sortBy).\n\n```javascript\n\u003e Z.sort (['foo', 'bar', 'baz'])\n['bar', 'baz', 'foo']\n\n\u003e Z.sort ([Just (2), Nothing, Just (1)])\n[Nothing, Just (1), Just (2)]\n\n\u003e Z.sort (Cons ('foo', Cons ('bar', Cons ('baz', Nil))))\nCons ('bar', Cons ('baz', Cons ('foo', Nil)))\n```\n\n#### \u003ca name=\"sortBy\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2209\"\u003e`sortBy :: (Ord b, Applicative f, Foldable f, Monoid (f a)) =\u003e (a -⁠\u003e b, f a) -⁠\u003e f a`\u003c/a\u003e\n\nPerforms a [stable sort][] of the elements of the given structure,\nusing [`lte`](#lte) to compare the values produced by applying the\ngiven function to each element of the structure.\n\nThis function is derived from [`lte`](#lte), [`concat`](#concat),\n[`empty`](#empty), [`of`](#of), and [`reduce`](#reduce).\n\nSee also [`sort`](#sort).\n\n```javascript\n\u003e Z.sortBy (s =\u003e s.length, ['red', 'green', 'blue'])\n['red', 'blue', 'green']\n\n\u003e Z.sortBy (s =\u003e s.length, ['black', 'white'])\n['black', 'white']\n\n\u003e Z.sortBy (s =\u003e s.length, ['white', 'black'])\n['white', 'black']\n\n\u003e Z.sortBy (s =\u003e s.length, Cons ('red', Cons ('green', Cons ('blue', Nil))))\nCons ('red', Cons ('blue', Cons ('green', Nil)))\n```\n\n#### \u003ca name=\"traverse\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2264\"\u003e`traverse :: (Applicative f, Traversable t) =\u003e (TypeRep f, a -⁠\u003e f b, t a) -⁠\u003e f (t b)`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/traverse`][].\n\n`fantasy-land/traverse` implementations are provided for the following\nbuilt-in types: Array and Object.\n\nSee also [`sequence`](#sequence).\n\n```javascript\n\u003e Z.traverse (Array, x =\u003e x, [[1, 2, 3], [4, 5]])\n[[1, 4], [1, 5], [2, 4], [2, 5], [3, 4], [3, 5]]\n\n\u003e Z.traverse (Identity, x =\u003e Identity (x + 1), [1, 2, 3])\nIdentity ([2, 3, 4])\n```\n\n#### \u003ca name=\"sequence\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2282\"\u003e`sequence :: (Applicative f, Traversable t) =\u003e (TypeRep f, t (f a)) -⁠\u003e f (t a)`\u003c/a\u003e\n\nInverts the given `t (f a)` to produce an `f (t a)`.\n\nThis function is derived from [`traverse`](#traverse).\n\n```javascript\n\u003e Z.sequence (Array, Identity ([1, 2, 3]))\n[Identity (1), Identity (2), Identity (3)]\n\n\u003e Z.sequence (Identity, [Identity (1), Identity (2), Identity (3)])\nIdentity ([1, 2, 3])\n```\n\n#### \u003ca name=\"extend\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2299\"\u003e`extend :: Extend w =\u003e (w a -⁠\u003e b, w a) -⁠\u003e w b`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/extend`][].\n\n`fantasy-land/extend` implementations are provided for the following\nbuilt-in types: Array and Function.\n\n```javascript\n\u003e Z.extend (ss =\u003e ss.join (''), ['x', 'y', 'z'])\n['xyz', 'yz', 'z']\n\n\u003e Z.extend (f =\u003e f ([3, 4]), Z.reverse) ([1, 2])\n[4, 3, 2, 1]\n```\n\n#### \u003ca name=\"duplicate\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2315\"\u003e`duplicate :: Extend w =\u003e w a -⁠\u003e w (w a)`\u003c/a\u003e\n\nAdds one level of nesting to a comonadic structure.\n\nThis function is derived from [`extend`](#extend).\n\n```javascript\n\u003e Z.duplicate (Identity (1))\nIdentity (Identity (1))\n\n\u003e Z.duplicate ([1])\n[[1]]\n\n\u003e Z.duplicate ([1, 2, 3])\n[[1, 2, 3], [2, 3], [3]]\n\n\u003e Z.duplicate (Z.reverse) ([1, 2]) ([3, 4])\n[4, 3, 2, 1]\n```\n\n#### \u003ca name=\"extract\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2336\"\u003e`extract :: Comonad w =\u003e w a -⁠\u003e a`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/extract`][].\n\n```javascript\n\u003e Z.extract (Identity (42))\n42\n```\n\n#### \u003ca name=\"contramap\" href=\"https://github.com/sanctuary-js/sanctuary-type-classes/blob/v13.0.0/index.js#L2346\"\u003e`contramap :: Contravariant f =\u003e (b -⁠\u003e a, f a) -⁠\u003e f b`\u003c/a\u003e\n\nFunction wrapper for [`fantasy-land/contramap`][].\n\n`fantasy-land/contramap` implementations are provided for the following\nbuilt-in types: Function.\n\n```javascript\n\u003e Z.contramap (s =\u003e s.length, Math.sqrt) ('Sanctuary')\n3\n```\n\n[Alt]:                      https://github.com/fantasyland/fantasy-land/tree/v5.0.0#alt\n[Alternative]:              https://github.com/fantasyland/fantasy-land/tree/v5.0.0#alternative\n[Applicative]:              https://github.com/fantasyland/fantasy-land/tree/v5.0.0#applicative\n[Apply]:                    https://github.com/fantasyland/fantasy-land/tree/v5.0.0#apply\n[Bifunctor]:                https://github.com/fantasyland/fantasy-land/tree/v5.0.0#bifunctor\n[Category]:                 https://github.com/fantasyland/fantasy-land/tree/v5.0.0#category\n[Chain]:                    https://github.com/fantasyland/fantasy-land/tree/v5.0.0#chain\n[ChainRec]:                 https://github.com/fantasyland/fantasy-land/tree/v5.0.0#chainrec\n[Comonad]:                  https://github.com/fantasyland/fantasy-land/tree/v5.0.0#comonad\n[Contravariant]:            https://github.com/fantasyland/fantasy-land/tree/v5.0.0#contravariant\n[Extend]:                   https://github.com/fantasyland/fantasy-land/tree/v5.0.0#extend\n[FL]:                       https://github.com/fantasyland/fantasy-land/tree/v5.0.0\n[Filterable]:               https://github.com/fantasyland/fantasy-land/tree/v5.0.0#filterable\n[Foldable]:                 https://github.com/fantasyland/fantasy-land/tree/v5.0.0#foldable\n[Functor]:                  https://github.com/fantasyland/fantasy-land/tree/v5.0.0#functor\n[Group]:                    https://github.com/fantasyland/fantasy-land/tree/v5.0.0#group\n[Monad]:                    https://github.com/fantasyland/fantasy-land/tree/v5.0.0#monad\n[Monoid]:                   https://github.com/fantasyland/fantasy-land/tree/v5.0.0#monoid\n[Ord]:                      https://github.com/fantasyland/fantasy-land/tree/v5.0.0#ord\n[Plus]:                     https://github.com/fantasyland/fantasy-land/tree/v5.0.0#plus\n[Profunctor]:               https://github.com/fantasyland/fantasy-land/tree/v5.0.0#profunctor\n[Semigroup]:                https://github.com/fantasyland/fantasy-land/tree/v5.0.0#semigroup\n[Semigroupoid]:             https://github.com/fantasyland/fantasy-land/tree/v5.0.0#semigroupoid\n[Setoid]:                   https://github.com/fantasyland/fantasy-land/tree/v5.0.0#setoid\n[Traversable]:              https://github.com/fantasyland/fantasy-land/tree/v5.0.0#traversable\n[`Object.entries`]:         https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries\n[`fantasy-land/alt`]:       https://github.com/fantasyland/fantasy-land/tree/v5.0.0#alt-method\n[`fantasy-land/ap`]:        https://github.com/fantasyland/fantasy-land/tree/v5.0.0#ap-method\n[`fantasy-land/bimap`]:     https://github.com/fantasyland/fantasy-land/tree/v5.0.0#bimap-method\n[`fantasy-land/chain`]:     https://github.com/fantasyland/fantasy-land/tree/v5.0.0#chain-method\n[`fantasy-land/chainRec`]:  https://github.com/fantasyland/fantasy-land/tree/v5.0.0#chainrec-method\n[`fantasy-land/compose`]:   https://github.com/fantasyland/fantasy-land/tree/v5.0.0#compose-method\n[`fantasy-land/concat`]:    https://github.com/fantasyland/fantasy-land/tree/v5.0.0#concat-method\n[`fantasy-land/contramap`]: https://github.com/fantasyland/fantasy-land/tree/v5.0.0#contramap-method\n[`fantasy-land/empty`]:     https://github.com/fantasyland/fantasy-land/tree/v5.0.0#empty-method\n[`fantasy-land/equals`]:    https://github.com/fantasyland/fantasy-land/tree/v5.0.0#equals-method\n[`fantasy-land/extend`]:    https://github.com/fantasyland/fantasy-land/tree/v5.0.0#extend-method\n[`fantasy-land/extract`]:   https://github.com/fantasyland/fantasy-land/tree/v5.0.0#extract-method\n[`fantasy-land/filter`]:    https://github.com/fantasyland/fantasy-land/tree/v5.0.0#filter-method\n[`fantasy-land/id`]:        https://github.com/fantasyland/fantasy-land/tree/v5.0.0#id-method\n[`fantasy-land/invert`]:    https://github.com/fantasyland/fantasy-land/tree/v5.0.0#invert-method\n[`fantasy-land/lte`]:       https://github.com/fantasyland/fantasy-land/tree/v5.0.0#lte-method\n[`fantasy-land/map`]:       https://github.com/fantasyland/fantasy-land/tree/v5.0.0#map-method\n[`fantasy-land/of`]:        https://github.com/fantasyland/fantasy-land/tree/v5.0.0#of-method\n[`fantasy-land/promap`]:    https://github.com/fantasyland/fantasy-land/tree/v5.0.0#promap-method\n[`fantasy-land/reduce`]:    https://github.com/fantasyland/fantasy-land/tree/v5.0.0#reduce-method\n[`fantasy-land/traverse`]:  https://github.com/fantasyland/fantasy-land/tree/v5.0.0#traverse-method\n[`fantasy-land/zero`]:      https://github.com/fantasyland/fantasy-land/tree/v5.0.0#zero-method\n[stable sort]:              https://en.wikipedia.org/wiki/Sorting_algorithm#Stability\n[type identities]:          https://github.com/sanctuary-js/sanctuary-type-identifiers/tree/v3.0.0\n[type-classes]:             https://github.com/sanctuary-js/sanctuary-def#type-classes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanctuary-js%2Fsanctuary-type-classes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanctuary-js%2Fsanctuary-type-classes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanctuary-js%2Fsanctuary-type-classes/lists"}