[{"name":"Graph","comment":" Your graph is defined by a type `a` and a function that give the next element in the graph, if any.\n`isCycle` tells you wether the graph is a cycle.\n\n\n# Cycle detection\n\n@docs isCycle, endOrCycle\n\n","unions":[],"aliases":[],"values":[{"name":"endOrCycle","comment":" Takes a function that gives the possible next element in the graph and the first element,\nand returns:\n\n    - (Ok x) if x is the output of the path\n    - (Err x) if x is the entry of a cycle\n\nExample usage:\n\nHere is a function that takes an integer and gives the next integer. The\ncycle loops for numbers above 5 and not for negative ones.\n\n    next : Int -> Maybe Int\n    next n = if n > 10 then Just 5 else if n == 0 then Nothing else Just (n + 1)\n\nThe output of the graph is at number 0:\n\n    endOrCycle next -5\n    --> Ok 0\n\nThere is a cycle, we can find the entry point of the cycle:\n\n    endOrCycle next 2\n    --> Err 5\n\n","type":"(a -> Maybe.Maybe a) -> a -> Result.Result a a"},{"name":"isCycle","comment":" Takes a function that gives the possible next element in the graph and the first element,\nreturns True if the graph is a cycle\n\nExample usage:\n\nHere is a function that takes an integer and gives the next integer. The\ncycle loops for numbers above 5 and not for negative ones.\n\n    next : Int -> Maybe Int\n    next n = if n > 10 then Just 5 else if n == 0 then Nothing else Just (n + 1)\n\nWe can check that the graph is a cycle if we start from above 0:\n\n    isCycle next 2\n    --> True\n\n    isCycle next -5\n    --> False\n\n","type":"(a -> Maybe.Maybe a) -> a -> Basics.Bool"}],"binops":[]}]