fork download
  1.  
  2. data Foo a = F (Foo a -> a -> a)
  3.  
  4. foo :: Foo a -> Foo a -> a -> a
  5. foo (F f) g x = f g x
  6.  
  7. m = F (\f x -> if x > 10 then x else foo f m (x + 1))
  8. --m = F (\f x -> foo f m (x + 1))
  9. n = F (\f x -> foo f n (x + 1))
  10.  
  11. main = print $ foo n m 5
Success #stdin #stdout 0s 5724KB
stdin
Standard input is empty
stdout
12