Skip to content

Instantly share code, notes, and snippets.

@zwilias
Last active March 24, 2019 11:15
Show Gist options
  • Save zwilias/f9f5f8fa7c6b2dbcadcc537c982035cd to your computer and use it in GitHub Desktop.
Save zwilias/f9f5f8fa7c6b2dbcadcc537c982035cd to your computer and use it in GitHub Desktop.
module Main where
type Extensible a =
{ count :: Int | a }
data State
= A (Extensible ( text :: String ))
| B (Extensible ( whatever :: String ))
updatePosition :: (forall a. Extensible a -> Extensible a) -> State -> State
updatePosition f state =
case state of
A x ->
A (f x)
B x ->
B (f x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment