Skip to main content

Posts

Featured

PatternSynonyms

For the 24 days of Haskell Extensions blog this is plagiarised from see here . Pattern Synonyms are essentially a way of aliasing pattern matches. For example, continuing my silly example habit: {-# LANGUAGE PatternSynonyms #-} module Example where main :: IO ( ) main = getChar >>= \ c -> print ( toChar . mirrorLetter . toLetter $ c ) data Letter = A | B | C | D | W | X | Y | Z toChar :: Letter -> Char toChar A = 'a' toChar B = 'b' toChar C = 'c' toChar D = 'd' toChar W = 'w' toChar X = 'x' toChar Y = 'y' toChar Z = 'z' toLetter :: Char -> Letter toLetter 'a' = A toLetter 'b' = B toLetter 'c' = C toLetter 'd' = D mirrorLetter :: Letter -> Letter mirrorLetter A = Z mirrorLetter B = Y mirrorLetter C = X mirrorLetter D = W The key thing to n

Latest posts

View Patterns

>> Is Still >>=

The Monad Module II : Applicative

The Monad Module I: Functors

Let's Talk About Monads

How to Raise a Social Issue in Github

f <*> g = \x -> f x (g x)

Functors and Applicative Functors

Feeling my way through Functional Programming

Falling in love with Elm