Entry tags:
wtf happened to ohaskell.ru?
Seems like the site does not exist anymore. Sad.
foldl (flip Cons) Nil
- сказал Тони.true x y = x false x y = y lampair :: a -> b -> (a -> b -> c) -> c lampair x y p = p x y pa :: ((a -> b -> c) ->c) -> a pa p = p true
• Couldn't match type ‘a’ with ‘c’ ‘a’ is a rigid type variable bound by the type signature for: pa :: forall a b c. ((a -> b -> c) -> c) -> a at sample1.hs:8:1-30 ‘c’ is a rigid type variable bound by the type signature for: pa :: forall a b c. ((a -> b -> c) -> c) -> a at sample1.hs:8:1-30 Expected type: a -> b -> c Actual type: c -> b -> c • In the first argument of ‘p’, namely ‘true’ In the expression: p true In an equation for ‘pa’: pa p = p true • Relevant bindings include p :: (a -> b -> c) -> c (bound at sample1.hs:9:4) pa :: ((a -> b -> c) -> c) -> a (bound at sample1.hs:9:1) |
List a = Codensity Endo a = forall r. (a -> r -> r) -> r -> r
nil :: List a
nil = \f z -> z
cons :: a -> List a -> List a
cons x xs = \f z -> f x (xs f z)
append :: List a -> List a -> List a
append xs ys = \f z -> xs f (ys f z)
foldr :: (a -> r -> r) -> r -> List a -> r
foldr f z xs = xs f z