Last active
October 12, 2017 01:56
-
-
Save imeckler/5376166 to your computer and use it in GitHub Desktop.
Haskell pipeline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs #-} | |
import Data.Char (digitToInt) | |
data Nil | |
data Cons a b | |
data Pipeline ts a c where | |
(:>) :: (a -> b) -> Pipeline ts b c -> Pipeline (Cons (a -> b) ts) a c | |
Id :: Pipeline Nil t t | |
infixr 9 :> | |
pHead :: Pipeline (Cons (a -> b) fs) a c -> (a -> b) | |
pHead (f :> _) = f | |
pTail :: Pipeline (Cons (a -> b) fs) a c -> Pipeline fs b c | |
pTail (_ :> fs) = fs | |
testP = digitToInt :> (+ 1) :> show :> Id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment