You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6 lines
311 B

4 years ago
  1. data List a = Nil | Cons a (List a);
  2. map f xs = case xs of { Nil -> Nil; Cons x xs -> Cons (f x) (map f xs) };
  3. readall k = getchar (\ch -> readall (\xs -> k (Cons ch xs))) (\ch -> k Nil);
  4. putall x xs = case xs of { Nil -> x; Cons x xs -> putchar x (\ch -> putall x xs) };
  5. id x = x;
  6. main x = readall (putall x);