Skip to content

Instantly share code, notes, and snippets.

@MarcelineVQ
Last active April 26, 2020 23:08
Show Gist options
  • Select an option

  • Save MarcelineVQ/49222f9789d8026bc9206365a5749d0e to your computer and use it in GitHub Desktop.

Select an option

Save MarcelineVQ/49222f9789d8026bc9206365a5749d0e to your computer and use it in GitHub Desktop.
data Identity a = MkId a
(>>=) : Identity a -> (a -> Identity b) -> Identity b
(>>=) (MkId x) f = f x
pure : a -> Identity a
pure = MkId
foo : Int -> Identity Balance
foo i = do
False <- pure (i > 1)
| True => pure RightHeavy
False <- pure (i == 1)
| True => pure RightLean
False <- pure (i == -1)
| True => pure LeftLean
False <- pure (i < -1)
| True => pure LeftHeavy
pure Neutral
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment