Guest User

Untitled

a guest
Mar 19th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. |||build a type signature out of a list of types
  2. ||| e.g.: `ListToSig [String, Int, Int]` returns String -> Int -> Int -> String
  3. ListToSig : List Type -> Type
  4. ListToSig [] = String
  5. ListToSig (x :: xs) = x -> ListToSig xs
  6.  
  7. ||| returns a function that builds a string from the arguments given to it
  8. ||| e.g.: `listToFunc [(String, show), (Int, show)] ""` returns a function f : String -> Int -> String
  9. ||| and when applied with input `f "hello" 3` gives "hello.3."
  10. listToFunc : {t : Type} -> (l : List (t, t -> String)) -> String -> ListToSig (map fst l)
  11. listToFunc [] x = x
  12. listToFunc ((a, f) :: xs) x = \arg => listToFunc xs ((f arg) ++ "." ++ x))
Add Comment
Please, Sign In to add comment