[Haskell-cafe] I Need a Better Functional Language!

Grigory Sarnitskiy sargrigory at ya.ru
Tue Apr 10 14:42:21 CEST 2012


 10.04.2012, 02:00, "Ryan Ingram" <ryani.spam at gmail.com>:
> A concurring opinion here, and an example.
>
> iff :: Bol -> a -> a -> a
> iff True x _ = x
> iff False _ x = x
>
> f, g :: Bool -> Bool
> f x = x
> g x = iff x True False
>
> Are these two functions equal?  I would say yes, they are.  Yet once you can pattern match on functions, you can easily tell these functions apart, and create a function
>
> h :: (Bool -> Bool) -> Bool
> such that h f => True but h g => False.
>
>   -- ryan

I've just remembered an interesting statement that there is a language where each equivalence class of programs Dan Doel mentioned (f = g  iff  forall x. f x = g x) has a single program in it. That is there is a one-to-one correspondence between programs and functions. Though as far as I understood one cannot construct a translator from this language to another language.



More information about the Haskell-Cafe mailing list