Skip to content

Instantly share code, notes, and snippets.

@stoeffel
Created June 8, 2016 07:22
Show Gist options
  • Save stoeffel/7b0c37d4d09eec2bc1e6734697216926 to your computer and use it in GitHub Desktop.
Save stoeffel/7b0c37d4d09eec2bc1e6734697216926 to your computer and use it in GitHub Desktop.
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