Created
June 8, 2016 07:22
-
-
Save stoeffel/7b0c37d4d09eec2bc1e6734697216926 to your computer and use it in GitHub Desktop.
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
import Html exposing (text) | |
import String | |
type alias ZipList a b = List (a -> b) | |
zipper : ZipList number number | |
zipper = [(*) 1, (*) 2, (*) 3] | |
zipper2 : ZipList number number | |
zipper2 = [(*) 1, (*) 2, (*) 3, (*) 4] | |
zipperStr : ZipList Int String | |
zipperStr = List.repeat 4 ((++) "!" << toString) | |
zipList : ZipList a b -> List a -> List b | |
zipList zipper list = | |
case (zipper, list) of | |
(x::zipperTail, y::listTail) -> | |
[x y] ++ zipList zipperTail listTail | |
(_, _) -> [] | |
result = zipList zipperStr [1, 2, 3, 4, 5] | |
main = | |
result | |
|> toString | |
|> text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment