[
    {
        "name": "Ordering",
        "comment": " Library for building comparison functions.\n\nThis library makes it easy to create comparison functions for arbitary types by composing\nsmaller comparison functions. For instance, suppose you are defining a data type to represent\na standard deck of cards. You might define it as:\n\n    type alias Card = { value : Value, suite : Suite }\n    type Suite = Clubs | Hearts | Diamonds | Spades\n    type Value = Two | Three | Four | Five | Six | Seven\n               | Eight | Nine | Ten | Jack | Queen | King | Ace\n\nWith this representation, you could define an ordering for `Card` values compositionally:\n\n    import Ordering exposing (Ordering)\n\n\n    cardOrdering : Ordering Card\n    cardOrdering =\n        Ordering.byFieldWith suiteOrdering .suite\n            |> Ordering.breakTiesWith\n                   (Ordering.byFieldWith valueOrdering .value)\n\n\n    suiteOrdering : Ordering Suite\n    suiteOrdering =\n        Ordering.explicit [Clubs, Hearts, Diamonds, Spades]\n\n\n    valueOrdering : Ordering Value\n    valueOrdering =\n        Ordering.explicit\n            [ Two , Three , Four , Five , Six , Seven\n            , Eight, Nine, Ten, Jack, Queen, King, Ace\n            ]\n\n\nYou can then use this ordering to sort cards, make comparisons, and so on. For instance,\nto sort a deck of cards you can use `cardOrdering` directly:\n\n    sortCards : List Card -> List Card\n    sortCards = List.sortWith cardOrdering\n\n# Definition\n@docs Ordering\n\n# Construction\n@docs natural, byToString, explicit, byField, byFieldWith\n\n# Composition\n@docs breakTiesWith, reverse\n\n# Utility\n@docs isOrdered, greaterThanBy, lessThanBy\n",
        "unions": [],
        "aliases": [
            {
                "name": "Ordering",
                "comment": " A function that compares two values and returns whether\nthe first is less than, equal to, or greater than the second.\n\nThough the type alias is provided by this library, its\ndefinition is chosen to be compatible with existing Elm functions\nthat accept ordering functions. So, for instance, you can\npass an ordering to `List.sortWith` directly:\n\n    type alias Point = { x : Int, y : Int }\n\n    myOrdering : Ordering Point\n    myOrdering =\n        Ordering.byField .x\n            |> Ordering.breakTiesWith (Ordering.byField .y)\n\n    List.sortWith myOrdering [Point 1 2, Point 2 3]\n",
                "args": [
                    "a"
                ],
                "type": "a -> a -> Order"
            }
        ],
        "values": [
            {
                "name": "breakTiesWith",
                "comment": " Produces an ordering that refines the second input ordering by using the first\nordering as a tie breaker. (Note that the second argument is the primary sort, and\nthe first argument is a tie breaker. This argument ordering is intended to support\nfunction chaining with `|>`.)\n\n    type alias Point = { x : Int, y : Int }\n\n    pointOrdering : Ordering Point\n    pointOrdering =\n        Ordering.byField .x\n            |> Ordering.breakTiesWith (Ordering.byField .y)\n",
                "type": "Ordering a -> Ordering a -> Ordering a"
            },
            {
                "name": "byField",
                "comment": " Produces an ordering that orders its elements using the natural ordering of the\nfield selected by the given function.\n\n    type alias Point = { x : Int, y : Int }\n\n    List.sort (Ordering.byField .x) [Point 3 5, Point 1 6]\n        == [Point 1 6, Point 3 5]\n    List.sort (Ordering.byField .y) [Point 3 5, Point 1 6]\n        == [Point 3 5, Point 1 6]\n",
                "type": "(a -> comparable) -> Ordering a"
            },
            {
                "name": "byFieldWith",
                "comment": " Produces an ordering that orders its elements using the given ordering on the\nfield selected by the given function.\n\n    cards =\n        [ { value = Two, suite = Spades }\n        , { value = King, suite = Hearts }\n        ]\n\n    List.sort\n        (Ordering.byFieldWith valueOrdering .value)\n        cards\n        == [ { value = Two, suite = Spades }\n           , { value = King, suite = Hearts }\n           ]\n    List.sort\n        (Ordering.byFieldWith suiteOrdering .suite)\n        cards\n        == [ { value = King, suite = Hearts }\n           , { value = Two, suite = Spades }\n           ]\n",
                "type": "Ordering b -> (a -> b) -> Ordering a"
            },
            {
                "name": "byToString",
                "comment": " Ordering that orders values lexicographically by their string representation.\nThis ordering can be useful for prototyping but it's usually better to replace it\nwith a hand-made ordering for serious use since `byToString` gives no way of tuning\nthe resulting ordering.\n",
                "type": "Ordering a"
            },
            {
                "name": "explicit",
                "comment": " Creates an ordering that orders items in the order given in the input list.\nItems that are not part of the input list are all considered to be equal to each\nother and less than anything in the list.\n\n    type Day = Mon | Tue | Wed | Thu | Fri | Sat | Sun\n\n    dayOrdering : Ordering Day\n    dayOrdering =\n        Ordering.explicit\n            [Mon, Tue, Wed, Thu, Fri, Sat, Sun]\n",
                "type": "List a -> Ordering a"
            },
            {
                "name": "greaterThanBy",
                "comment": " Determines if one value is greater than another according to the given ordering.\n\n    greaterThanBy\n        xThenYOrdering\n        { x = 7, y = 8 }\n        { x = 10, y = 2 }\n        == False\n\n    greaterThanBy\n        yThenXOrdering\n        { x = 7, y = 8 }\n        { x = 10, y = 2 }\n        == True\n",
                "type": "Ordering a -> a -> a -> Bool"
            },
            {
                "name": "isOrdered",
                "comment": " Determines if the given list is ordered according to the given ordering.\n\n    Ordering.isOrdered Ordering.natural [1, 2, 3]\n        == True\n    Ordering.isOrdered Ordering.natural [2, 1, 3]\n        == False\n    Ordering.isOrdered Ordering.natural []\n        == True\n    Ordering.isOrdered\n        (Ordering.reverse Ordering.natural)\n        [1, 2, 3]\n        == False\n",
                "type": "Ordering a -> List a -> Bool"
            },
            {
                "name": "lessThanBy",
                "comment": " Determines if one value is less than another according to the given ordering.\n\n    lessThanBy\n        xThenYOrdering\n        { x = 7, y = 8 }\n        { x = 10, y = 2 }\n        == True\n\n    lessThanBy\n        yThenXOrdering\n        { x = 7, y = 8 }\n        { x = 10, y = 2 }\n        == False\n",
                "type": "Ordering a -> a -> a -> Bool"
            },
            {
                "name": "natural",
                "comment": " Ordering that works with any built-in comparable type.\n\n    -- orders in numeric order: 1, 2, 3, ...\n    intOrdering : Ordering Int\n    intOrdering = natural\n\n\n    -- orders lexicographically: \"a\", \"ab\", \"b\", ...\n    stringOrdering : Ordering String\n    stringOrdering : natural\n",
                "type": "Ordering comparable"
            },
            {
                "name": "reverse",
                "comment": " Returns an ordering that reverses the input ordering.\n\n    List.sortWith\n        (Ordering.reverse Ordering.natural)\n        [1, 2, 3, 4, 5]\n        == [5, 4, 3, 2, 1]\n",
                "type": "Ordering a -> Ordering a"
            }
        ],
        "binops": []
    }
]