Skip to content

Instantly share code, notes, and snippets.

@probablytom
Last active May 7, 2017 14:34
Show Gist options
  • Save probablytom/8ce5b5792589184c34e8a7a0b67f8250 to your computer and use it in GitHub Desktop.
Save probablytom/8ce5b5792589184c34e8a7a0b67f8250 to your computer and use it in GitHub Desktop.

Arrows

Arrows are generalisations of Monads, which raise function composition into the type system using type-level functions. They're absolutely not examinable.

Amazingly, this is valid Haskell.

type T a b = a -> b
f = (\x -> show x) :: T Int String  -- this is a value -- not a function -- which represents the transformation of an Integer to a STring.
f 3 -- "3"

Notice that the type of f is a single value, with no currying, even though f does perform computation:

-- f :: T Int String

I don't understand Arrows, but I'm sure this is the beginning of them. Try it in ghci.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment