[{"name":"Ra","comment":" Ra supports Pointfree style in Elm by providing various combinators to work with Predicates, Relations, Math, Functions, and Flow Control.\n\nPointfree can be abused, but when it is appropriate pointfree style is\n\n  - More Readable & Literate. The declaration of the lambda with an argument and repetitious application of the argument can obscure the meaning.\n  - Safer. It is impossible to inadvertently pass the wrong value because functions are only composed and not applied or called.el\n\n\n### Predicate Combinators\n\n@docs allPass, anyPass, both, either, complement, false, true\n\n\n### Chain and Composition Friendly Relations\n\n@docs lessThan, lessThanEqualTo, greaterThan, greaterThanEqualTo, equals\n\n\n### Chain and Composition Friendly Math\n\n@docs adding, subtracting, dividedByInt, dividedByFloat, multiplying, negated\n\n\n### Flow Control\n\n@docs ifElse, cond, condDefault, when, unless, until\n\n\n### Function Combinators\n\n@docs converge, converge3, convergeList, curry, curry3, flip, fnContraMap, fnContraMap2, fnContraMap3, uncurry, uncurry3\n\n\n## Name and Relation to RamdaJS\n\nRa is a subset of RamdaJS converted to Elm and excluding functions relating to topics indicated below. I originally toyed with naming this package simply R but that would create confusion with the R language.\n\n\n## Miscellaneous\n\n@docs isMemberOf, deduplicateConsecutiveItemsBy\n\n\n### Excellent elm-community Extra packages such as\n\nMany of the RamdaJS functions or their equivalent functionality can be found in these packages.\n\n  - [Maybe.Extra](https://package.elm-lang.org/packages/elm-community/maybe-extra/latest/)\n  - [List.Extra](https://package.elm-lang.org/packages/elm-community/list-extra/latest/)\n      - aperture is [groupsOfWithStep](https://package.elm-lang.org/packages/elm-community/list-extra/latest/List-Extra#groupsOfWithStep)\n  - [Dict.Extra](https://package.elm-lang.org/packages/elm-community/dict-extra/latest/)\n      - [groupBy](https://package.elm-lang.org/packages/elm-community/dict-extra/2.4.0/Dict-Extra#groupBy)\n      - indexedBy is [fromListBy](https://package.elm-lang.org/packages/elm-community/dict-extra/2.4.0/Dict-Extra#fromListBy)\n      - countBy is one List.map away from [frequencies](https://package.elm-lang.org/packages/elm-community/dict-extra/2.4.0/Dict-Extra#frequencies)\n\n\n### Object Meta-Programming\n\nRamdaJS features a number of functions to manipulate JavaScript objects. The closest equivalent in Elm would be Dict which already features all of the necessary functions\neither through Core or Dict.Extra. Further, Dict is not the same as Record and has a number of tradeoffs when compared to Records\n\n  - lose of explicit type contract\n      - requiring neurotic optionality checks (i.e. Dict.get returns a Maybe)\n  - a Dict can only hold values of a single type while a Record may feature a different type for each field.\n\n\n### Relating to Optics (Lens)\n\nThere are several high quality Elm packages that provide optics.\n\n\n### Higher-Kinded Types and Categories\n\nElm does not feature higher kinded types or typeclasses and so we cannot express abstract\n\n  - `map` (Functor)\n  - `chain` (Monad)\n  - `append` (Monoid)\n  - `sequence`/`traverse` (Applicative, Traversable).\n\n**NOTE** We get better error messages, fewer opportunities for ambiguous code, and, very likely, a faster compiler in the exchange.\n\n","unions":[],"aliases":[],"values":[{"name":"adding","comment":" A literate alias for addition that is nice for building functional pipelines by avoiding parenthesis.\n\n    List.map <| adding 5\n\nrather than\n\n    List.map <| (+) 5\n\n","type":"number -> number -> number"},{"name":"allPass","comment":" Takes a list of predicates and returns a predicate that returns true for a given list of arguments if every one of the provided predicates is satisfied by those arguments.\n\n    isAmazing : Person -> Bool\n    isAmazing = allPass [isKind, isCreative, isHardWorking, isIntelligent]\n\n","type":"List.List (Ra.Predicate a) -> a -> Basics.Bool"},{"name":"anyPass","comment":" Takes a list of predicates and returns a predicate that returns true for a given list of arguments if at least one of the provided predicates is satisfied by those arguments.\n\n    hasAtLeastOneGoodQuality : Person -> Bool\n    hasAtLeastOneGoodQuality = anyPass [Person.isKind, Person.isCreative, Person.isHardWorking, Person.isIntelligent]\n\n","type":"List.List (Ra.Predicate a) -> a -> Basics.Bool"},{"name":"both","comment":" Return a new predicate that is true if both of the two predicates return true.\nNote that this is short-circuited, meaning that the second predicate will not be invoked if the first returns false.\n","type":"Ra.Predicate a -> Ra.Predicate a -> a -> Basics.Bool"},{"name":"complement","comment":" Invert (negate, complement) a predicate i.e if the predicate would have return True for some `a` it will now return False and vice versa.\n","type":"Ra.Predicate a -> Ra.Predicate a"},{"name":"cond","comment":" Returns a function which encapsulates if/else, if/else, ... logic given a list of (predicate, transformer) tuples.\n\n  - The condition pairs are processed in order\n      - and returns the transformation of the first predicate that passes\n  - If no conditions pass then returns Nothing.\n\n","type":"List.List ( Ra.Predicate a, a -> b ) -> a -> Maybe.Maybe b"},{"name":"condDefault","comment":" Same as `cond` but also provides a default option in the case that none of the conditions pass.\n","type":"List.List ( Ra.Predicate a, a -> b ) -> Ra.Thunk b -> a -> b"},{"name":"converge","comment":" This function can best be explained with examples as it is unusually useful when building data pipelines but has a tricky type signature.\n\nPlease do NOT be afraid of the type signature!\n\nIf you would like a function that transforms a Person to a String of their first and last name.\n\n    converge\n        String.append\n        ( .firstName, .lastName >> String.append \" \" )\n\nOr perhaps you are building a data pipeline\n\n  - where at some stage you have a `List Widget`\n  - and you have a function `extraWidgets: List Widget -> List Widget`\n  - and you would like to like to end up with a new list of widgets that contains both the original widgets and the extra widgets.\n\nThen you might write\n\n    converge\n        List.append\n        (identity, extraWidgets)\n\n","type":"(first -> second -> output) -> ( input -> first, input -> second ) -> input -> output"},{"name":"converge3","comment":" Converge for the case of a 3 argument function. See `converge` for examples.\n","type":"(first -> second -> third -> output) -> ( input -> first, input -> second, input -> third ) -> input -> output"},{"name":"convergeList","comment":" As with converge, convergeList is best explained with an example\n\n    convergeList\n        (String.join \" \")\n        [ .firstName, .middleInitial, .lastName ]\n\nOr to be more complete\n\n    nonEmptyStrings : List String -> List String\n    nonEmptyStrings = List.filter (complement String.isEmpty)\n\n    fullName : Person -> String\n    fullName =\n        convergeList\n            (nonEmptyStrings >> String.join \" \")\n            [ .firstName, .middleInitial, .lastName ]\n\n","type":"(List.List a -> output) -> List.List (input -> a) -> input -> output"},{"name":"curry","comment":" Converts a function from 2-tuple to normal curried function. This is mostly useful for reverting an uncurry.\n","type":"(( a, b ) -> c) -> a -> b -> c"},{"name":"curry3","comment":" Converts a function from 3-tuple to normal curried function. This is mostly useful for reverting an uncurry.\n","type":"(( a, b, c ) -> d) -> a -> b -> c -> d"},{"name":"deduplicateConsecutiveItemsBy","comment":" Deduplicate consecutive items in a list using a function to extra the element of interest.\n\n    deduplicateConsecutiveItemsBy identity [ 1, 1, 1, 2, 3, 3 ] -- [1, 2, 3]\n\n    deduplicateConsecutiveItemsBy\n        Tuple.second\n        [ (\"Betty\", 1), (\"Tom\", 1), (\"Jane\", 2)] -- [(\"Betty\", 1), (\"Jane\", 2)]\n\n","type":"(a -> b) -> List.List a -> List.List a"},{"name":"dividedByFloat","comment":" Division designed for pipelines i.e. the divisor is the first argument.\n\n    20\n    |> dividedByFloat 2.5 -- 8.0\n\n    [20, 25, 26.25]\n    |> List (divideByFloat 2.5) -- [8.0, 10.0, 10.5]\n\n","type":"Basics.Float -> Basics.Float -> Basics.Float"},{"name":"dividedByInt","comment":" Division designed for pipelines i.e. the divisor is the first argument.\n\n    20\n    |> divideByInt 4 -- 5\n\n    [20, 32, 40]\n    |> List (divideByInt 4) -- [5, 8, 10]\n\n","type":"Basics.Int -> Basics.Int -> Basics.Int"},{"name":"either","comment":" Return a new predicate that is true if either of the two predicates return true.\nNote that this is short-circuited, meaning that the second predicate will not be invoked if the first returns true.\n","type":"Ra.Predicate a -> Ra.Predicate a -> a -> Basics.Bool"},{"name":"equals","comment":" A natural language alias for `==` that also helps to avoid parenthesis when writing point-free flows\n\n    employees\n    |> List.filter <| .employmentType >> equals Contractor\n\n","type":"a -> Ra.Predicate a"},{"name":"false","comment":" A predicate that always returns false.\n","type":"Ra.Predicate a"},{"name":"flip","comment":" Flip the first and second arguments of a function.\n\n  - This is an incredibly useful function when needing to change the application of an existing function.\n  - **WARNING** However, it can also destroy the literate reading of code if overused and it is easy to overuse.\n\nFor example, the first argument to Dict.get is the key and the second is the dictionary.\nWhat if we want to map over multiple keys? We would want to apply the dictionary first and get a function that accepts the key.\n\n    valuesForKeys : Dict comparable value -> List comparable -> List value\n    valuesForKeys =\n        flip Dict.get >> List.filterMap\n\nMore simply, consider the case of having a `(Dictionary k v)` of values but wanting to pass along a function `k -> Maybe v` to some provider\nso that the provider doesn't couple to the Dictionary? This would be a good idea to Reduce Coupling and honor the Principle of Least Privilege.\n\n    someInterestingProvider : (Int -> Widget) -> String -> Maybe Widget\n    someInterestingProvider = Debug.todo \"doesn't matter for the demonstration\"\n\n    someConsumer : List Widget -> String -> Maybe Widget\n    someConsumer widgets =\n        someInterestingProvider (flip Dict.get (indexBy .id widgets))\n\n","type":"(a -> b -> c) -> b -> a -> c"},{"name":"fnContraMap","comment":" This is like `map` for functions but going the opposite direction (contra functor).\n\n  - map: (a -> b) -> F a -> F b\n  - contraMap: (a -> b) -> F b -> F a\n\nOKAY. So that it probably a little or a lot confusing. How would you use this? Any time yout have a parent/child relation and a function that\nwill transform the child and you want to get back a function that transforms the parent.\n\n    addressesCount : Person -> Int\n    addressesCount = fnContraMap .addresses List.length\n\n","type":"(a -> b) -> (b -> c) -> a -> c"},{"name":"fnContraMap2","comment":" Best described with an example. Let's say you have a parent/child relation, a function of 2 arguments that applies to the child type\nand you would like to get back a function that works on the parent.\n\n    sameFavoriteColor : Person -> Person -> Bool\n    sameFavoriteColor = fnContraMap2 (.favorites >> .color) (==)\n\n","type":"(a -> b) -> (b -> b -> c) -> a -> a -> c"},{"name":"fnContraMap3","comment":" Same as fnContraMap2 but for 3 argument functions.\n","type":"(a -> b) -> (b -> b -> b -> c) -> a -> a -> a -> c"},{"name":"greaterThan","comment":" Designed for currying. Returns a predicate that tests if the value is greater than the first value given.\n\n    20 |> greaterThan 10 -- True\n\n    20 |> greaterThan 20 -- False\n\n    [5, 10, 11, 20]\n    |> List.map (greaterThan 10) -- [False, False, True, True]\n\n","type":"comparable -> comparable -> Basics.Bool"},{"name":"greaterThanEqualTo","comment":" Designed for currying. Returns a predicate that tests if the value is greater than or equal to the first value given.\n\n    20 |> greaterThanEqualTo 10 -- True\n\n    20 |> greaterThanEqualTo 20 -- False\n\n    [5, 10, 11, 20]\n    |> List.map (greaterThanEqualTo 10) -- [False, True, True, True]\n\n","type":"comparable -> comparable -> Basics.Bool"},{"name":"ifElse","comment":" Creates a function that will process either the whenTrue or the whenFalse function depending upon the result of the condition predicate.\n\n    ifElse\n        (.weightInLbs >> R.Relation.greaterThan 500)\n        (.name >> String.append \"Sorry. You cannot ride the rollercoaster \")\n        (.name >> String.append \"Enjoy your ride \")\n\n","type":"Ra.Predicate a -> (a -> b) -> (a -> b) -> a -> b"},{"name":"isMemberOf","comment":" Dict.member with the arguments flipped in order to test the member of _many_ keys against a _single_ dictionary.\n\n    let\n        validPersonIds =\n            personIds\n            |> List.filter (isMemberOf idToPerson)\n    in\n    -- ...\n\n","type":"Dict.Dict comparable v -> comparable -> Basics.Bool"},{"name":"lessThan","comment":" Designed for use in pipelines or currying. Returns a predicate that tests if the value is less than the first value given.\n\n    20 |> lessThan 10 -- False\n\n    20 |> lessThan 30 -- True\n\n","type":"comparable -> comparable -> Basics.Bool"},{"name":"lessThanEqualTo","comment":" Designed for currying. Returns a predicate that tests if the value is less than or equal to the first value given.\n\n    20 |> lessThanEqualTo 10 -- False\n\n    20 |> lessThanEqualTo 20 -- True\n\n    [5, 10, 11, 20]\n    |> List.map (lessThanEqualto 10) -- [True, True, False, False]\n\n","type":"comparable -> comparable -> Basics.Bool"},{"name":"multiplying","comment":" A natural language alias for \\*.\n","type":"number -> number -> number"},{"name":"negated","comment":" Negate the given number.\n","type":"number -> number"},{"name":"subtracting","comment":" Subtraction alias designed for pipelines i.e. the order is swapped such that the subtrahend is the first argument.\n\n    10\n    |> subtracting 4 -- 6\n\n    [20, 30, 40]\n    |> List.map (subtracting 6) -- [14, 24, 34]\n\n","type":"number -> number -> number"},{"name":"true","comment":" A predicate that always returns true.\n","type":"Ra.Predicate a"},{"name":"uncurry","comment":" Converts a normal Elm function to a function that accepts a 2-tuple. This can be useful if the output of some function happens to be\na tuple or a functor (List, Maybe, Result, etc.) of a tuple.\n\n    sums : List (number, number) -> List number\n    sums = List.map (uncurry adding)\n\n    sum : Maybe (number, number) -> Maybe number\n    sum = Maybe.map (uncurry adding)\n\n","type":"(a -> b -> c) -> ( a, b ) -> c"},{"name":"uncurry3","comment":" Converts a standard Elm function to a function that accepts a 3-tuple.\n","type":"(a -> b -> c -> d) -> ( a, b, c ) -> d"},{"name":"unless","comment":" Tests the final argument by passing it to the given predicate function.\n\n  - If the predicate is not satisfied, the function will return the result of calling the whenFalseFn function with the same argument.\n  - If the predicate is satisfied, the argument is returned as is.\n\n","type":"Ra.Predicate a -> (a -> a) -> a -> a"},{"name":"until","comment":" Takes a predicate, a transformation function, and an initial value, and returns a value of the same type as the initial value.\nIt does so by applying the transformation until the predicate is satisfied, at which point it returns the satisfactory value.\n","type":"Ra.Predicate a -> (a -> a) -> a -> a"},{"name":"when","comment":" Tests the final argument by passing it to the given predicate function.\n\n  - If the predicate is satisfied, the function will return the result of calling the whenTrueFn function with the same argument.\n  - If the predicate is not satisfied, the argument is returned as is.\n\n","type":"Ra.Predicate a -> (a -> a) -> a -> a"}],"binops":[]}]