[{"name":"HoleyFocusList","comment":" A list zipper that can also focus on a hole _between_ items.\n\n1.  🔎 focus on a hole between two items\n2.  🔌 plug that hole with a value\n3.  💰 profit\n\n\n## types\n\n@docs HoleyFocusList, Item\n\n\n## create\n\n@docs empty, only\n\n\n## scan\n\n@docs current, before, after\n\n\n## navigate\n\n@docs next, previous, nextHole, previousHole\n@docs first, last, beforeFirst, afterLast\n@docs findForward, findBackward\n\n\n## modify\n\n@docs append, prepend\n\n\n### modify the focus\n\n@docs mapCurrent, plug, remove\n\n\n### modify around the focus\n\n@docs mapBefore, mapAfter\n@docs insertAfter, insertBefore\n@docs squeezeInBefore, squeezeInAfter\n\n\n## transform\n\n@docs map, mapParts, joinParts, toList\n\n\n## type-level\n\n@docs focussesItem, branchableType\n\n","unions":[{"name":"HoleyFocusList","comment":" Represents a special kind of list with items of type `a`.\n\nThe type `focus` can be\n\n  - `🍍 🍓 <🍊> 🍉 🍇`: use [`Item`](#Item) to require such an argument\n\n  - `🍍 🍓 <?> 🍉 🍇`: use a type variable to require such an argument\n\n    `<?>` means both are possible:\n\n      - `🍍 🍓 <> 🍉 🍇`: a hole between items ... Heh.\n      - `🍍 🍓 <🍊> 🍉 🍇`\n\n","args":["focus","a"],"cases":[]}],"aliases":[{"name":"Item","comment":" A `HoleyFocusList Item a` is focussed on an element of type `a`.\n\n```monospace\n🍍 🍓 <🍊> 🍉 🍇\n```\n\n","args":[],"type":"MaybeIs.CanBe { hole : () } Basics.Never"}],"values":[{"name":"after","comment":" The items after the current focussed location in the `HoleyFocusList`.\n\n```monospace\n🍍 🍓 <🍊> (🍉 🍇\n```\n\n    HoleyFocusList.only 0\n        |> HoleyFocusList.append [ 1, 2, 3 ]\n        |> HoleyFocusList.next\n        |> Maybe.map HoleyFocusList.after\n    --> Just [ 2, 3 ]\n\n","type":"HoleyFocusList.HoleyFocusList focus_ a -> List.List a"},{"name":"afterLast","comment":" Focus the hole after the end of the `HoleyFocusList`. Into the nothingness.\n\n```monospace\n🍓 <🍊> 🍉  ->  🍓 🍊 🍉 <>\n```\n\n    import ListIs\n\n    HoleyFocusList.only 1                 -- <1>\n        |> HoleyFocusList.append [ 2, 3 ] -- <1> 2 3\n        |> HoleyFocusList.afterLast       -- 1 2 3 <>\n        |> HoleyFocusList.plug 4          -- 1 2 3 <4>\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons 1 [ 2, 3, 4 ]\n\n","type":"HoleyFocusList.HoleyFocusList focus_ a -> HoleyFocusList.HoleyFocusList (MaybeIs.CanBe hole_ ()) a"},{"name":"append","comment":" Put items to the end of the `HoleyFocusList`. After anything else.\n\n```monospace\n              🍒🍋\n🍓 <🍊> 🍉 🍇 ↓/\n```\n\n    import ListIs\n\n    HoleyFocusList.only 123\n        |> HoleyFocusList.append [ 456 ]\n        |> HoleyFocusList.append [ 789, 0 ]\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons 123 [ 456, 789, 0 ]\n\n","type":"List.List a -> HoleyFocusList.HoleyFocusList focus a -> HoleyFocusList.HoleyFocusList focus a"},{"name":"before","comment":" The items before the location of the focus in the `HoleyFocusList`.\n\n```monospace\n🍍 🍓) <🍊> 🍉 🍇\n```\n\n    HoleyFocusList.only 0\n        |> HoleyFocusList.append [ 1, 2, 3 ]\n        |> HoleyFocusList.next\n        |> Maybe.andThen HoleyFocusList.next\n        |> Maybe.map HoleyFocusList.before\n    --> Just [ 0, 1 ]\n\n","type":"HoleyFocusList.HoleyFocusList focus_ a -> List.List a"},{"name":"beforeFirst","comment":" Focus the hole before the first item.\nRemember that holes surround everything!\n\n```monospace\n🍍 🍓 <🍊> 🍉  ->  <> 🍍 🍓 🍊 🍉\n```\n\n    import ListIs\n\n    HoleyFocusList.only 1                 -- <1>\n        |> HoleyFocusList.append [ 3, 4 ] -- <1> 3 4\n        |> HoleyFocusList.nextHole        -- 1 <> 3 4\n        |> HoleyFocusList.plug 2          -- 1 <2> 3 4\n        |> HoleyFocusList.beforeFirst     -- <> 1 2 3 4\n        |> HoleyFocusList.plug 0          -- <0> 1 2 3 4\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons 0 [ 1, 2, 3, 4 ]\n\n","type":"HoleyFocusList.HoleyFocusList focus_ a -> HoleyFocusList.HoleyFocusList (MaybeIs.CanBe hole_ ()) a"},{"name":"branchableType","comment":" When using a `HoleyFocusList Item ...` argument,\nits type can't be unified with non-`Item` lists.\n\nPlease read more at [`MaybeIs.branchableType`](MaybeIs#branchableType).\n\n","type":"HoleyFocusList.HoleyFocusList HoleyFocusList.Item a -> HoleyFocusList.HoleyFocusList item_ a"},{"name":"current","comment":" The current focussed item in the `HoleyFocusList`.\n\n```monospace\n🍍 🍓 <🍊> 🍉 🍇  ->  🍊\n```\n\n    HoleyFocusList.only \"hi there\"\n        |> HoleyFocusList.current\n    --> \"hi there\"\n\n    HoleyFocusList.only 1\n        |> HoleyFocusList.append [ 2, 3, 4 ]\n        |> HoleyFocusList.last\n        |> HoleyFocusList.current\n    --> 4\n\n","type":"HoleyFocusList.HoleyFocusList HoleyFocusList.Item a -> a"},{"name":"empty","comment":" An empty `HoleyFocusList` focussed on a hole with nothing before\nand after it.\nIt's the loneliest of all `HoleyFocusList`s.\n\n```monospace\n<>\n```\n\n    import ListIs\n\n    HoleyFocusList.empty\n        |> HoleyFocusList.joinParts\n    --> ListIs.empty\n\n","type":"HoleyFocusList.HoleyFocusList (MaybeIs.CanBe hole_ ()) a_"},{"name":"findBackward","comment":" Find the first item in the `HoleyFocusList` matching a predicate, moving backwards\nfrom the current position.\n\n    HoleyFocusList.only 4\n        |> HoleyFocusList.prepend [ 2, -1, 0, 3 ]\n        |> HoleyFocusList.findBackward (\\item -> item < 0)\n        |> Maybe.map HoleyFocusList.current\n    --> Just -1\n\n","type":"(a -> Basics.Bool) -> HoleyFocusList.HoleyFocusList focus_ a -> Maybe.Maybe (HoleyFocusList.HoleyFocusList item_ a)"},{"name":"findForward","comment":" Find the first item in the `HoleyFocusList` the matches a predicate, returning a\n`HoleyFocusList` focussed on that item if it was found.\n\nThis start from the current focussed location and searches towards the end.\n\n    HoleyFocusList.only 4\n        |> HoleyFocusList.append [ 2, -1, 0, 3 ]\n        |> HoleyFocusList.findForward (\\item -> item < 0)\n        |> Maybe.map HoleyFocusList.current\n    --> Just -1\n\n    HoleyFocusList.only -4\n        |> HoleyFocusList.append [ 2, -1, 0, 3 ]\n        |> HoleyFocusList.findForward (\\item -> item < 0)\n        |> Maybe.map HoleyFocusList.current\n    --> Just -4\n\n","type":"(a -> Basics.Bool) -> HoleyFocusList.HoleyFocusList focus_ a -> Maybe.Maybe (HoleyFocusList.HoleyFocusList item_ a)"},{"name":"first","comment":" Focus the first item in the `HoleyFocusList`.\n\n```monospace\n🍍 🍓 <🍊> 🍉  ->  <🍍> 🍓 🍊 🍉\n```\n\n    HoleyFocusList.only 1\n        |> HoleyFocusList.append [ 2, 3, 4 ]\n        |> HoleyFocusList.prepend [ 4, 3, 2 ]\n        |> HoleyFocusList.first\n        |> HoleyFocusList.current\n    --> 4\n\n","type":"HoleyFocusList.HoleyFocusList focus a -> HoleyFocusList.HoleyFocusList focus a"},{"name":"focussesItem","comment":" Find out if the current focussed thing is an item.\n\n    import MaybeIs\n\n    HoleyFocusList.only 3\n        |> HoleyFocusList.append [ 2, 1 ]\n        |> HoleyFocusList.nextHole\n        |> HoleyFocusList.focussesItem\n    --> MaybeIs.nothing\n\n","type":"HoleyFocusList.HoleyFocusList (MaybeIs.CanBe holeTag_ yesOrNever) a -> MaybeIs.MaybeIs (MaybeIs.CanBe emptyTag_ yesOrNever) (HoleyFocusList.HoleyFocusList item_ a)"},{"name":"insertAfter","comment":" Insert an item after the focussed location.\n\n```monospace\n        🍒\n🍓 <🍊> ↓ 🍉 🍇\n```\n\n    import ListIs\n\n    HoleyFocusList.only 123\n        |> HoleyFocusList.append [ 789 ]\n        |> HoleyFocusList.insertAfter 456\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons 123 [ 456, 789 ]\n\nInsert multiple items using [`squeezeInAfter`](#squeezeInAfter).\n\n","type":"a -> HoleyFocusList.HoleyFocusList focus a -> HoleyFocusList.HoleyFocusList focus a"},{"name":"insertBefore","comment":" Insert an item before the focussed location.\n\n```monospace\n      🍒\n🍍 🍓 ↓ <🍊> 🍉\n```\n\n    import ListIs\n\n    HoleyFocusList.only 123\n        |> HoleyFocusList.insertBefore 456\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons 456 [ 123 ]\n\nInsert multiple items using [`squeezeInBefore`](#squeezeInBefore).\n\n","type":"a -> HoleyFocusList.HoleyFocusList focus a -> HoleyFocusList.HoleyFocusList focus a"},{"name":"joinParts","comment":" Flattens the `HoleyFocusList` into a [`ListIs`](ListIs):\n\n    import ListIs\n\n    HoleyFocusList.empty\n        |> HoleyFocusList.joinParts\n    --> ListIs.empty\n\n    HoleyFocusList.only 123\n        |> HoleyFocusList.append [ 789 ]\n        |> HoleyFocusList.nextHole\n        |> HoleyFocusList.plug 456\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons 123 [ 456, 789 ]\n\nthe type information gets carried over, so\n\n    Item -> ListIs.NotEmpty\n    CanBe hole_ () -> CanBe empty_ ()\n\n","type":"HoleyFocusList.HoleyFocusList (MaybeIs.CanBe holeTag_ yesOrNever) a -> ListIs.ListIs (MaybeIs.CanBe emptyTag_ yesOrNever) a"},{"name":"last","comment":" Focus the last item in the `HoleyFocusList`.\n\n```monospace\n🍓 <🍊> 🍉 🍇  ->  🍓 🍊 🍉 <🍇>\n```\n\n    HoleyFocusList.only 1\n        |> HoleyFocusList.append [ 2, 3, 4 ]\n        |> HoleyFocusList.last\n        |> HoleyFocusList.current\n    --> 4\n\n    HoleyFocusList.only 1\n        |> HoleyFocusList.append [ 2, 3, 4 ]\n        |> HoleyFocusList.last\n        |> HoleyFocusList.before\n    --> [ 1, 2, 3 ]\n\n","type":"HoleyFocusList.HoleyFocusList focus a -> HoleyFocusList.HoleyFocusList focus a"},{"name":"map","comment":" Execute a function on every item in the `HoleyFocusList`.\n\n    import ListIs\n\n    HoleyFocusList.only \"first\"\n        |> HoleyFocusList.prepend [ \"zeroth\" ]\n        |> HoleyFocusList.append [ \"second\", \"third\" ]\n        |> HoleyFocusList.map String.toUpper\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons \"ZEROTH\" [ \"FIRST\", \"SECOND\", \"THIRD\" ]\n\n","type":"(a -> b) -> HoleyFocusList.HoleyFocusList (MaybeIs.CanBe hole_ yesOrNever) a -> HoleyFocusList.HoleyFocusList (MaybeIs.CanBe mappedHole_ yesOrNever) b"},{"name":"mapAfter","comment":" Apply a function to all items coming after the current focussed location.\n\n    import ListIs\n\n    HoleyFocusList.only \"zeroth\"\n        |> HoleyFocusList.append [ \"first\", \"second\" ]\n        |> HoleyFocusList.mapAfter String.toUpper\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons \"zeroth\" [ \"FIRST\", \"SECOND\" ]\n\n","type":"(a -> a) -> HoleyFocusList.HoleyFocusList focus a -> HoleyFocusList.HoleyFocusList focus a"},{"name":"mapBefore","comment":" Apply a function to all items coming before the current focussed location.\n\n    import ListIs\n\n    HoleyFocusList.only \"second\"\n        |> HoleyFocusList.prepend [ \"zeroth\", \"first\" ]\n        |> HoleyFocusList.mapBefore String.toUpper\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons \"ZEROTH\" [ \"FIRST\", \"second\" ]\n\n","type":"(a -> a) -> HoleyFocusList.HoleyFocusList focus a -> HoleyFocusList.HoleyFocusList focus a"},{"name":"mapCurrent","comment":" If an item is focussed in the `HoleyFocusList`, apply a function to it.\n\n    import ListIs\n\n    HoleyFocusList.only \"first\"\n        |> HoleyFocusList.prepend [ \"zeroth\" ]\n        |> HoleyFocusList.append [ \"second\", \"third\" ]\n        |> HoleyFocusList.mapCurrent String.toUpper\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons \"zeroth\" [ \"FIRST\", \"second\", \"third\" ]\n\n","type":"(a -> a) -> HoleyFocusList.HoleyFocusList (MaybeIs.CanBe hole_ yesOrNever) a -> HoleyFocusList.HoleyFocusList (MaybeIs.CanBe mappedHole_ yesOrNever) a"},{"name":"mapParts","comment":" Apply multiple different functions on the parts of a `HoleyFocusList` - what\ncomes before, what comes after, and the current item if there is one.\n\n    import ListIs\n\n    HoleyFocusList.only \"first\"\n        |> HoleyFocusList.append [ \"second\" ]\n        |> HoleyFocusList.nextHole\n        |> HoleyFocusList.plug \"one-and-a-halfth\"\n        |> HoleyFocusList.mapParts\n            { before = (++) \"before: \"\n            , current = (++) \"current: \"\n            , after = (++) \"after: \"\n            }\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons\n    -->     \"before: first\"\n    -->     [ \"current: one-and-a-halfth\"\n    -->     , \"after: second\"\n    -->     ]\n\n","type":"{ before : a -> b, current : a -> b, after : a -> b } -> HoleyFocusList.HoleyFocusList (MaybeIs.CanBe hole_ yesOrNever) a -> HoleyFocusList.HoleyFocusList (MaybeIs.CanBe mappedHole_ yesOrNever) b"},{"name":"next","comment":" Move the focus of the `HoleyFocusList` to the next item, if there is one.\n\n```monospace\n<🍊> 🍉 🍇  ->  🍊 <🍉> 🍇\n```\n\n    HoleyFocusList.only 0\n        |> HoleyFocusList.append [ 1, 2, 3 ]\n        |> HoleyFocusList.next\n        |> Maybe.map HoleyFocusList.current\n    --> Just 1\n\nThis also works from within holes:\n\n```monospace\n🍊 <> 🍉 🍇  ->  🍊 <🍉> 🍇\n```\n\n    HoleyFocusList.empty\n        |> HoleyFocusList.insertAfter \"foo\"\n        |> HoleyFocusList.next\n    --> Just (HoleyFocusList.only \"foo\")\n\nIf there is no `next` item, the result is `Nothing`.\n\n    HoleyFocusList.empty\n        |> HoleyFocusList.next\n    --> Nothing\n\n\n    HoleyFocusList.only 0\n        |> HoleyFocusList.append [ 1, 2, 3 ]\n        |> HoleyFocusList.last\n        |> HoleyFocusList.next\n    --> Nothing\n\n","type":"HoleyFocusList.HoleyFocusList focus_ a -> Maybe.Maybe (HoleyFocusList.HoleyFocusList item_ a)"},{"name":"nextHole","comment":" Move the `HoleyFocusList` to the hole right after the current item. A hole is a whole\nlot of nothingness, so it's always there.\n\n```monospace\n🍍 <🍊> 🍉  ->  🍍 🍊 <> 🍉\n```\n\n    import ListIs\n\n    HoleyFocusList.only \"hello\"\n        |> HoleyFocusList.append [ \"world\" ]\n        |> HoleyFocusList.nextHole\n        |> HoleyFocusList.plug \"holey\"\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons \"hello\" [ \"holey\", \"world\" ]\n\n","type":"HoleyFocusList.HoleyFocusList HoleyFocusList.Item a -> HoleyFocusList.HoleyFocusList (MaybeIs.CanBe hole_ ()) a"},{"name":"only","comment":" A `HoleyFocusList` with a single focussed item in it, nothing before and after it.\n\n```monospace\n<🍊>\n```\n\n    import ListIs\n\n    HoleyFocusList.only \"wat\"\n        |> HoleyFocusList.current\n    --> \"wat\"\n\n    HoleyFocusList.only \"wat\"\n        |> HoleyFocusList.joinParts\n    --> ListIs.only \"wat\"\n\n","type":"a -> HoleyFocusList.HoleyFocusList item_ a"},{"name":"plug","comment":" Fill in or replace the focussed thing in the `HoleyFocusList`.\n\n```monospace\n🍓 <?> 🍉  ->  🍓 <🍒> 🍉\n```\n\n    import ListIs\n\n    HoleyFocusList.empty\n        |> HoleyFocusList.insertBefore \"🍓\" -- \"🍓\" <>\n        |> HoleyFocusList.insertAfter \"🍉\"  -- \"🍓\" <> \"🍉\"\n        |> HoleyFocusList.plug \"🍒\"         -- \"🍓\" <\"🍒\"> \"🍉\"\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons \"🍓\" [ \"🍒\", \"🍉\" ]\n\n","type":"a -> HoleyFocusList.HoleyFocusList holeOrItem_ a -> HoleyFocusList.HoleyFocusList item_ a"},{"name":"prepend","comment":" Put items to the beginning of the `HoleyFocusList`. Before anything else.\n\n```monospace\n🍒🍋\n \\↓ 🍍 🍓 <🍊> 🍉\n```\n\n    import ListIs\n\n    HoleyFocusList.only 1\n        |> HoleyFocusList.append [ 2, 3, 4 ]\n        |> HoleyFocusList.last\n        |> HoleyFocusList.prepend [ 5, 6, 7 ]\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons 5 [ 6, 7, 1, 2, 3, 4 ]\n\n","type":"List.List a -> HoleyFocusList.HoleyFocusList focus a -> HoleyFocusList.HoleyFocusList focus a"},{"name":"previous","comment":" Move the focus of the `HoleyFocusList` to the previous item, if there is one.\n\n```monospace\n🍊 <🍉> 🍇  ->  <🍊> 🍉 🍇\n```\n\n    HoleyFocusList.empty |> HoleyFocusList.previous\n    --> Nothing\n\n    HoleyFocusList.only \"hello\"\n        |> HoleyFocusList.append [ \"holey\", \"world\" ]\n        |> HoleyFocusList.last\n        |> HoleyFocusList.previous\n        |> Maybe.map HoleyFocusList.current\n    --> Just \"holey\"\n\nThis also works from within holes:\n\n```monospace\n🍊 🍉 <> 🍇  ->  🍊 <🍉> 🍇\n```\n\n    HoleyFocusList.empty\n        |> HoleyFocusList.insertBefore \"foo\"\n        |> HoleyFocusList.previous\n    --> Just (HoleyFocusList.only \"foo\")\n\n","type":"HoleyFocusList.HoleyFocusList focus_ a -> Maybe.Maybe (HoleyFocusList.HoleyFocusList item_ a)"},{"name":"previousHole","comment":" Move the `HoleyFocusList` to the hole right before the current item. Feel free to plug\nthat hole right up!\n\n```monospace\n🍍 <🍊> 🍉  ->  🍍 <> 🍊 🍉\n```\n\n    import ListIs\n\n    HoleyFocusList.only \"world\"\n        |> HoleyFocusList.previousHole\n        |> HoleyFocusList.plug \"hello\"\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons \"hello\" [ \"world\" ]\n\n","type":"HoleyFocusList.HoleyFocusList HoleyFocusList.Item a -> HoleyFocusList.HoleyFocusList (MaybeIs.CanBe hole_ ()) a"},{"name":"remove","comment":" Punch a hole into the `HoleyFocusList` by removing the focussed thing.\n\n```monospace\n🍓 <?> 🍉  ->  🍓 <> 🍉\n```\n\n    HoleyFocusList.only \"hello\"\n        |> HoleyFocusList.append [ \"holey\", \"world\" ]\n        |> HoleyFocusList.next\n        |> Maybe.map HoleyFocusList.remove\n        |> Maybe.map HoleyFocusList.toList\n    --> Just [ \"hello\", \"world\" ]\n\n","type":"HoleyFocusList.HoleyFocusList focus_ a -> HoleyFocusList.HoleyFocusList (MaybeIs.CanBe hole_ ()) a"},{"name":"squeezeInAfter","comment":" Append items directly after the focussed location in the `HoleyFocusList`.\n\n```monospace\n        🍒🍋\n🍓 <🍊> \\↓/ 🍉 🍇\n```\n\n    import ListIs\n\n    HoleyFocusList.only 0\n        |> HoleyFocusList.squeezeInAfter [ 4, 5 ]\n        |> HoleyFocusList.squeezeInAfter [ 1, 2, 3 ]\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons 0 [ 1, 2, 3, 4, 5 ]\n\n","type":"List.List a -> HoleyFocusList.HoleyFocusList focus a -> HoleyFocusList.HoleyFocusList focus a"},{"name":"squeezeInBefore","comment":" Prepend items directly before the focussed location in the `HoleyFocusList`.\n\n```monospace\n      🍒🍋\n🍍 🍓 \\↓/ <🍊> 🍉\n```\n\n    import ListIs\n\n    HoleyFocusList.only 0\n        |> HoleyFocusList.squeezeInBefore [ -5, -4 ]\n        |> HoleyFocusList.squeezeInBefore [ -3, -2, -1 ]\n        |> HoleyFocusList.joinParts\n    --> ListIs.fromCons -5 [ -4, -3, -2, -1, 0 ]\n\n","type":"List.List a -> HoleyFocusList.HoleyFocusList focus a -> HoleyFocusList.HoleyFocusList focus a"},{"name":"toList","comment":" Flattens the `HoleyFocusList` into a list:\n\n    HoleyFocusList.only 456\n        |> HoleyFocusList.prepend [ 123 ]\n        |> HoleyFocusList.append [ 789 ]\n        |> HoleyFocusList.toList\n    --> [ 123, 456, 789 ]\n\nOnly use this if you need a list in the end.\nOtherwise, use [`joinParts`](#joinParts) to preserve some information about its length.\n\n","type":"HoleyFocusList.HoleyFocusList focus_ a -> List.List a"}],"binops":[]},{"name":"ListIs","comment":"\n\n\n## types\n\n@docs ListIs, NotEmpty\n@docs ListWithHeadType\n\n\n## create\n\n@docs empty, only, fromCons, fromUnConsed, fromList\n\n\n## scan\n\n@docs head, tail, length\n\n\n## modify\n\n@docs cons\n\n\n## glue\n\n@docs append, appendNotEmpty, concat\n\n\n### filter\n\n@docs when, whenJust\n\n\n## transform\n\n@docs map, mapHead, mapTail, foldFrom, fold, toList, unCons\n@docs map2, map2HeadsAndTails\n\n","unions":[],"aliases":[{"name":"ListIs","comment":" Describes an empty or non-empty list, making it more convenient than any `Nonempty`.\n\nWe can require a [`NotEmpty`](#NotEmpty) for example:\n\n    toNonempty : ListIs NotEmpty a -> Nonempty a\n\n`ListIs` is equivalent to a [`MaybeIs`](MaybeIs) of a non-empty list tuple:\n\n    MaybeIs emptyOrNot ( a, List a )\n\nso we can treat it like a normal [`MaybeIs`](MaybeIs):\n\n    import MaybeIs exposing (MaybeIs(..))\n\n    ListIs.empty\n    --> MaybeIs.nothing\n\n    [ ... ]\n        |> ListIs.fromList\n        |> MaybeIs.map ListIs.head\n    --: MaybeIs (CanBe nothingTag_ ()) head_\n\n    toList : ListIs emptyOrNot_ a -> List a\n    toList list =\n        case list of\n            IsJust ( head_, tail_ ) ->\n                head_ :: tail_\n\n            IsNothing _ ->\n                []\n\n","args":["emptyOrNot","a"],"type":"ListIs.ListWithHeadType a emptyOrNot a"},{"name":"ListWithHeadType","comment":" Describes an empty or non-empty list where the head type can be different from the tail element type.\n\nUse [`ListIs`](#ListIs) if you have matching head and tail element types.\n\n`ListWithHeadType` is the result of:\n\n  - [`empty`](#empty)\n  - [`only`](#only)\n  - [`fromCons`](#fromCons)\n  - [`fromUnConsed`](#fromUnConsed)\n  - [`cons`](#cons)\n  - [`mapHead`](#mapHead)\n  - [`map2HeadsAndTails`](#map2HeadsAndTails)\n\nThis is equivalent to a [`MaybeIs`](MaybeIs) of a `( head, tail )` tuple:\n\n    import MaybeIs exposing (MaybeIs(..))\n\n    ListIs.empty\n    --> MaybeIs.nothing\n\n    MaybeIs.map ListIs.head\n    --: ListWithHeadType head (CanBe empty_ yesOrNever) tailElement_\n    --: -> MaybeIs (CanBe nothingTag_ yesOrNever) head\n\n    tail : ListWithHead head_ tailElement -> List tailElement\n    tail listNotEmpty =\n        case listNotEmpty of\n            IsJust ( _, tailList ) ->\n                tailList\n\n            IsNothing _ ->\n                []\n\n","args":["head","emptyOrNot","tailElement"],"type":"MaybeIs.MaybeIs emptyOrNot ( head, List.List tailElement )"},{"name":"NotEmpty","comment":" `NotEmpty` can be used to require a non-empty list as an argument:\n\n    head : ListWithHeadType head NotEmpty tailElement_ -> head\n\n","args":[],"type":"MaybeIs.CanBe { empty : () } Basics.Never"}],"values":[{"name":"append","comment":" Glue the elements of a `ListIs` to the end of a `ListIs`.\n\n    ListIs.fromCons 1 [ 2 ]\n        |> ListIs.append\n            (ListIs.fromCons 3 [ 4 ])\n    --> ListIs.fromCons 1 [ 2, 3, 4 ]\n\nPrefer this over [`appendNotEmpty`](#appendNotEmpty) if the piped `ListIs` is already known as `NotEmpty`\nor if both can be empty.\n\n","type":"ListIs.ListIs appendedEmptyOrNot_ a -> ListIs.ListIs emptyOrNot a -> ListIs.ListIs emptyOrNot a"},{"name":"appendNotEmpty","comment":" Glue the elements of a `ListIs NotEmpty ...` to the end of a `ListIs`.\n\n    ListIs.empty\n        |> ListIs.appendNotEmpty\n            (ListIs.fromCons 1 [ 2 ])\n        |> ListIs.append\n            (ListIs.fromCons 3 [ 4, 5 ])\n    --> ListIs.fromCons 1 [ 2, 3, 4, 5 ]\n\nPrefer [`append`](#append) if the piped `ListIs` is already known as `NotEmpty`\nor if both can be empty.\n\n","type":"ListIs.ListIs ListIs.NotEmpty a -> ListIs.ListIs emptyOrNot_ a -> ListIs.ListIs ListIs.NotEmpty a"},{"name":"concat","comment":" Glue together a bunch of lists.\n\n    ListIs.fromCons\n        (ListIs.fromCons 0 [ 1 ])\n        [ ListIs.fromCons 10 [ 11 ]\n        , ListIs.empty\n        , ListIs.fromCons 20 [ 21, 22 ]\n        ]\n        |> ListIs.concat\n    --> ListIs.fromCons 0 [ 1, 10, 11, 20, 21, 22 ]\n\nFor this to return a `ListIs notEmpty`, there must be a non-empty first list.\n\n","type":"ListIs.ListWithHeadType (ListIs.ListIs emptyOrNot a) emptyOrNot (ListIs.ListIs tailListsEmptyOrNot_ a) -> ListIs.ListIs emptyOrNot a"},{"name":"cons","comment":" Add an element to the front of a list.\n\n    ListIs.fromCons 2 [ 3 ] |> ListIs.cons 1\n    --> ListIs.fromCons 1 [ 2, 3 ]\n\n    ListIs.empty |> ListIs.cons 1\n    --> ListIs.only 1\n\n","type":"newHead -> ListIs.ListIs emptyOrNot_ a -> ListIs.ListWithHeadType newHead ListIs.NotEmpty a"},{"name":"empty","comment":" A `ListIs` without elements.\n\nEquivalent to `MaybeIs.nothing`.\n\n","type":"ListIs.ListWithHeadType head_ (MaybeIs.CanBe empty_ ()) tailElement_"},{"name":"fold","comment":" A fold in a [direction](https://package.elm-lang.org/packages/lue-bird/elm-linear-direction/latest/)\nwhere the initial result is the first value in the `ListIs`.\n\n    import LinearDirection exposing (LinearDirection(..))\n\n    ListIs.fromCons 234 [ 345, 543 ]\n        |> ListIs.fold FirstToLast max\n    --> 543\n\n","type":"LinearDirection.LinearDirection -> (tailElement -> acc -> acc) -> ListIs.ListWithHeadType acc ListIs.NotEmpty tailElement -> acc"},{"name":"foldFrom","comment":" Reduce a List in a [direction](https://package.elm-lang.org/packages/lue-bird/elm-linear-direction/latest/).\n\n    import LinearDirection exposing (LinearDirection(..))\n\n    ListIs.fromCons 'l' [ 'i', 'v', 'e' ]\n        |> ListIs.foldFrom \"\" LastToFirst String.cons\n    --> \"live\"\n\n    ListIs.fromCons 'l' [ 'i', 'v', 'e' ]\n        |> ListIs.foldFrom \"\" FirstToLast String.cons\n    --> \"evil\"\n\n","type":"acc -> LinearDirection.LinearDirection -> (a -> acc -> acc) -> ListIs.ListIs emptyOrNot_ a -> acc"},{"name":"fromCons","comment":" Build a `notEmpty_` from its head and tail.\n","type":"head -> List.List tailElement -> ListIs.ListWithHeadType head notEmpty_ tailElement"},{"name":"fromList","comment":" Convert a `List a` to a `ListIs (CanBe emptyTag_ ()) a`.\n\n    [] |> ListIs.fromList\n    --> ListIs.empty\n\n    [ \"hello\", \"emptiness\" ] |> ListIs.fromList\n    --> ListIs.fromCons \"hello\" [ \"emptiness\" ]\n    --: ListIs (CanBe emptyTag_ ()) String\n\nWhen constructing from known elements, always prefer\n\n    ListIs.fromCons \"hello\" [ \"emptiness\" ]\n\n","type":"List.List a -> ListIs.ListIs (MaybeIs.CanBe emptyTag_ ()) a"},{"name":"fromUnConsed","comment":" Convert a non-empty list tuple `( a, List b )` to a `ListWithHeadType a notEmpty_ b`.\n\nEquivalent to `MaybeIs.just`.\n\n","type":"( head, List.List tailElement ) -> ListIs.ListWithHeadType head notEmpty_ tailElement"},{"name":"head","comment":" The first value in the `ListIs`.\n\n    ListIs.only 3\n        |> ListIs.cons 2\n        |> ListIs.head\n    --> 2\n\n","type":"ListIs.ListWithHeadType head ListIs.NotEmpty tailElement_ -> head"},{"name":"length","comment":" How many element there are.\n\n    ListIs.only 3\n        |> ListIs.cons 2\n        |> ListIs.length\n    --> 2\n\n","type":"ListIs.ListWithHeadType head_ emptyOrNot_ tailElement_ -> Basics.Int"},{"name":"map","comment":" Apply a function to every element.\n\n    ListIs.fromCons 1 [ 4, 9 ]\n        |> ListIs.map negate\n    --> ListIs.fromCons -1 [ -4, -9 ]\n\n","type":"(a -> b) -> ListIs.ListIs (MaybeIs.CanBe empty_ yesOrNever) a -> ListIs.ListIs (MaybeIs.CanBe mappedEmpty_ yesOrNever) b"},{"name":"map2","comment":" Combine 2 `ListIs`s with a given function.\nIf one list is longer, its extra elements are dropped.\n\n    ListIs.map2 (+)\n        (ListIs.fromCons 1 [ 2, 3 ])\n        (ListIs.fromCons 4 [ 5, 6, 7 ])\n    --> ListIs.fromCons 5 [ 7, 9 ]\n\n    ListIs.map2 Tuple.pair\n        (ListIs.fromCons 1 [ 2, 3 ])\n        ListIs.empty\n    --> ListIs.empty\n\nFor `ListWithHeadType head ... tailElement` where `head` and `tailElement` have a different type,\nthere's [`map2HeadsAndTails`](#map2HeadsAndTails).\n\n","type":"(a -> b -> combined) -> ListIs.ListIs (MaybeIs.CanBe aEmpty_ yesOrNever) a -> ListIs.ListIs (MaybeIs.CanBe bEmpty_ yesOrNever) b -> ListIs.ListIs (MaybeIs.CanBe combinedEmpty_ yesOrNever) combined"},{"name":"map2HeadsAndTails","comment":" Combine the head and tail elements of 2 `ListIs`s using given functions.\nIf one list is longer, its extra elements are dropped.\n\n    ListIs.map2HeadsAndTails Tuple.pair (+)\n        (ListIs.fromCons \"hey\" [ 0, 1 ])\n        (ListIs.fromCons \"there\" [ 1, 6, 7 ])\n    --> ListIs.fromCons ( \"hey\", \"there\" ) [ 1, 7 ]\n\n    ListIs.map2HeadsAndTails Tuple.pair (+)\n        (ListIs.fromCons 1 [ 2, 3 ])\n        ListIs.empty\n    --> ListIs.empty\n\nFor matching `head` and `tailElement` types, there's [`map2`](#map2).\n\n","type":"(aHead -> bHead -> combinedHead) -> (aTailElement -> bTailElement -> combinedTailElement) -> ListIs.ListWithHeadType aHead (MaybeIs.CanBe aEmpty_ yesOrNever) aTailElement -> ListIs.ListWithHeadType bHead (MaybeIs.CanBe bEmpty_ yesOrNever) bTailElement -> ListIs.ListWithHeadType combinedHead (MaybeIs.CanBe combinedEmpty_ yesOrNever) combinedTailElement"},{"name":"mapHead","comment":" Apply a function to the head only.\n\n    ListIs.fromCons 1 [ 4, 9 ]\n        |> ListIs.mapHead negate\n    --> ListIs.fromCons -1 [ 4, 9 ]\n\n","type":"(head -> mappedHead) -> ListIs.ListWithHeadType head (MaybeIs.CanBe empty_ yesOrNever) tailElement -> ListIs.ListWithHeadType mappedHead (MaybeIs.CanBe mappedEmpty_ yesOrNever) tailElement"},{"name":"mapTail","comment":" Apply a function to every element of its tail.\n\n    ListIs.fromCons 1 [ 4, 9 ]\n        |> ListIs.mapTail negate\n    --> ListIs.fromCons 1 [ -4, -9 ]\n\n","type":"(tailElement -> mappedTailElement) -> ListIs.ListWithHeadType head (MaybeIs.CanBe empty_ yesOrNever) tailElement -> ListIs.ListWithHeadType head (MaybeIs.CanBe mappedEmpty_ yesOrNever) mappedTailElement"},{"name":"only","comment":" A `ListIs` with just 1 element.\n\n    ListIs.only \":)\"\n    --> ListIs.empty |> ListIs.cons \":)\"\n\n","type":"head -> ListIs.ListWithHeadType head notEmpty_ tailElement_"},{"name":"tail","comment":" Everything after the first value in the `ListIs`.\n\n    ListIs.only 2\n        |> ListIs.cons 3\n        |> ListIs.append (ListIs.fromCons 1 [ 0 ])\n        |> ListIs.tail\n    --> [ 2, 1, 0 ]\n\n","type":"ListIs.ListWithHeadType head_ ListIs.NotEmpty tailElement -> List.List tailElement"},{"name":"toList","comment":" Convert the `ListIs` to a `List`.\n\n    ListIs.fromCons 1 [ 7 ]\n        |> ListIs.toList\n    --> [ 1, 7 ]\n\n","type":"ListIs.ListIs emptyOrNot_ a -> List.List a"},{"name":"unCons","comment":" Convert a `ListWithHeadType a NotEmpty b` to a non-empty list tuple `( a, List b )`.\n\nEquivalent to `MaybeIs.value`.\n\n","type":"ListIs.ListWithHeadType head ListIs.NotEmpty tailElement -> ( head, List.List tailElement )"},{"name":"when","comment":" Keep elements that satisfy the test.\n\n    ListIs.fromCons 1 [ 2, 5, -3, 10 ]\n        |> ListIs.when (\\x -> x < 5)\n    --> ListIs.fromCons 1 [ 2, -3 ]\n    --: ListIs (CanBe emptyTag_ ()) number_\n\n","type":"(a -> Basics.Bool) -> ListIs.ListIs emptyOrNot_ a -> ListIs.ListIs (MaybeIs.CanBe emptyTag_ ()) a"},{"name":"whenJust","comment":" Keep all `just` values and drop all `Nothing`s.\n\n    ListIs.fromCons Nothing [ Nothing ]\n        |> ListIs.whenJust\n    --> ListIs.empty\n\n    ListIs.fromCons (just 1) [ Nothing, just 3 ]\n        |> ListIs.whenJust\n    --> ListIs.fromCons 1 [ 3 ]\n    --: ListIs NotEmpty number\n\nAs you can see, if the head is `just` a value, the result is [`NotEmpty`](#NotEmpty).\n\n","type":"ListIs.ListWithHeadType (MaybeIs.MaybeIs emptyOrNot headValue) emptyOrNot (MaybeIs.MaybeIs tailElementEmptyOrNot_ tailElementValue) -> ListIs.ListWithHeadType headValue emptyOrNot tailElementValue"}],"binops":[]},{"name":"MaybeIs","comment":" `Maybe` with the ability to know at the type level whether it exists.\n\n    import MaybeIs exposing (just)\n\n    [ just 1, just 7 ]\n        --: List (MaybeIs just_ number_)\n        |> List.map MaybeIs.value\n    --> [ 1, 7 ]\n\n`MaybeIs` alone will probably not proof any useful,\nbut we can build cool type-safe data structures with it:\n\n    type alias ListIs emptyOrNot a =\n        MaybeIs emptyOrNot ( a, List a )\n\n    type alias NotEmpty =\n        MaybeIs.CanBe { empty : () } Never\n\n    type alias Emptiable =\n        MaybeIs.CanBe { empty : () } ()\n\n    empty : ListIs Emptiable a_\n\n    cons : ListIs emptyOrNot_ a -> a -> ListIs notEmpty_ a\n\n    head : ListIs NotEmpty a -> a\n\nThis is exactly how [`ListIs`](ListIs) is implemented.\n\n\n## types\n\n@docs CanBe, MaybeIs\n\n\n## create\n\n@docs just, nothing, fromMaybe\n\n\n## transform\n\n@docs map, map2, toMaybe, value, andThen, withFallback\n\n\n## type-level\n\n@docs branchableType\n\n","unions":[{"name":"CanBe","comment":" `CanBe` is just a cleaner version of this.\nIt has a simple type tag to make `Never` values distinct:\n\n    type alias NotEmpty =\n        CanBe { empty : () } Never\n\n    type alias Item =\n        CanBe { hole : () } Never\n\n_Remember to update the tag after renaming an alias._\n\nNow the fun part:\n\n    joinParts :\n        HoleyFocusList (CanBe hole_ yesOrNever) a\n        -> ListIs (CanBe empty_ yesOrNever) a\n    joinParts ... =\n        case ( before, focus, after ) of\n            ( [], StringEmpty (CanBe yesOrNever), [] ) ->\n                IsNothing\n                    --↓ carries over the `yesOrNever` type,\n                    --↓ while allowing a new tag\n                    (CanBe yesOrNever)\n\n            ... -> ...\n\n> the type information gets carried over, so\n>\n>     HoleyFocusList.Item -> ListIs.NotEmpty\n>     CanBe hole_ () -> CanBe empty_ ()\n\nRead more in the readme!\n\n","args":["stateTag","neverOrValue"],"cases":[["CanBe",["neverOrValue"]]]},{"name":"MaybeIs","comment":" Like `Maybe` with type level information about whether it exists. See [`CanBe`](#CanBe).\n","args":["justOrNothing","a"],"cases":[["IsNothing",["justOrNothing"]],["IsJust",["a"]]]}],"aliases":[],"values":[{"name":"andThen","comment":" Chain together many computations that may fail.\n\n    maybeString\n        |> MaybeIs.andThen parse\n        |> MaybeIs.andThen extraValidation\n\n    parse : String -> MaybeIs CanBe Parsed\n    extraValidation : Parsed -> MaybeIs CanBe Validated\n\n","type":"(a -> MaybeIs.MaybeIs (MaybeIs.CanBe thenNothingTag yesOrNever) b) -> MaybeIs.MaybeIs (MaybeIs.CanBe nothingTag_ yesOrNever) a -> MaybeIs.MaybeIs (MaybeIs.CanBe thenNothingTag yesOrNever) b"},{"name":"branchableType","comment":" When using `CanBe ... Never` for an argument:\n\n    theShorter :\n        ListIs (CanBe { empty : () } Never) a\n        -> ListIs emptyOrNot a\n        -> ListIs emptyOrNot a\n    theShorter aList bList =\n        if ListIs.length bList > ListIs.length aList then\n            bList\n\n        else\n            --↓ `NotEmpty` but we need `emptyOrNot`\n            aList\n\nto make both branches return `emptyOrNot`, we could use\n\n    aList |> ListType.unCons |> ListType.fromUnConsed\n\nalso known as: necessary code that nobody will understand.\n\n    aList |> MaybeIs.branchableType\n\nis a bit better.\n\n💙 Found a better name? → open an issue.\n\n","type":"MaybeIs.MaybeIs (MaybeIs.CanBe impossibleStateTag_ Basics.Never) a -> MaybeIs.MaybeIs just_ a"},{"name":"fromMaybe","comment":" Convert a `Maybe` to a `MaybeIs`.\n","type":"Maybe.Maybe a -> MaybeIs.MaybeIs (MaybeIs.CanBe possibleStateTag_ ()) a"},{"name":"just","comment":" A `MaybeIs` that certainly exists.\n\n    MaybeIs.just \"you\" |> MaybeIs.value\n    --> \"you\"\n\n","type":"value -> MaybeIs.MaybeIs just_ value"},{"name":"map","comment":" Transform the value in the `MaybeIs` using a given function:\n\n    import MaybeIs exposing (just, nothing)\n\n    MaybeIs.map abs (just -3) --> just 3\n    MaybeIs.map abs nothing --> nothing\n\n","type":"(a -> b) -> MaybeIs.MaybeIs (MaybeIs.CanBe nothingTag_ yesOrNever) a -> MaybeIs.MaybeIs (MaybeIs.CanBe mappedNothingTag_ yesOrNever) b"},{"name":"map2","comment":" If all the arguments exist, combine them using a given function.\n\n    import MaybeIs exposing (just, nothing)\n\n    MaybeIs.map2 (+) (just 3) (just 4) --> just 7\n    MaybeIs.map2 (+) (just 3) nothing --> nothing\n    MaybeIs.map2 (+) nothing (just 4) --> nothing\n\n","type":"(a -> b -> combined) -> MaybeIs.MaybeIs (MaybeIs.CanBe aNothingTag_ yesOrNever) a -> MaybeIs.MaybeIs (MaybeIs.CanBe bNothingTag_ yesOrNever) b -> MaybeIs.MaybeIs (MaybeIs.CanBe combinedNothingTag_ yesOrNever) combined"},{"name":"nothing","comment":" Nothing here.\n","type":"MaybeIs.MaybeIs (MaybeIs.CanBe possibleStateTag_ ()) a_"},{"name":"toMaybe","comment":" Convert a `MaybeIs` to a `Maybe`.\n","type":"MaybeIs.MaybeIs justOrNothing_ a -> Maybe.Maybe a"},{"name":"value","comment":" Safely extracts the `value` from a `MaybeIs (CanBe nothingTag_ Never) value`.\n\n    import MaybeIs exposing (just, MaybeIs)\n\n    just (just (just \"you\"))\n        |> MaybeIs.value\n        |> MaybeIs.value\n        |> MaybeIs.value\n    --> \"you\"\n\n    head : MaybeIs (CanBe empty_ Never) ( a, List a ) -> a\n    head =\n        MaybeIs.value >> Tuple.first\n\nSee [`CanBe`](#CanBe) and [`ListIs`](ListIs).\n\n","type":"MaybeIs.MaybeIs (MaybeIs.CanBe impossibleStateTag_ Basics.Never) value -> value"},{"name":"withFallback","comment":" Lazily use a fallback value if the `MaybeIs` is [`nothing`](#nothing).\n\n    import Dict\n\n    Dict.empty\n        |> Dict.get \"Tom\"\n        |> MaybeIs.fromMaybe\n        |> MaybeIs.withFallback (\\() -> \"unknown\")\n    --> \"unknown\"\n\nHint: `MaybeIs.withFallback never` is equivalent to `MaybeIs.value`.\n\n","type":"(unitOrNever -> value) -> MaybeIs.MaybeIs (MaybeIs.CanBe stateTag_ unitOrNever) value -> value"}],"binops":[]}]