[Haskell-beginners] Simple function comparison

Henk-Jan van Tuyl hjgtuyl at chello.nl
Wed Nov 25 23:49:45 UTC 2015


On Wed, 25 Nov 2015 12:39:15 +0100, Stephen Renehan <d11124067 at mydit.ie>  
wrote:

> Hi,
>
> I'm looking to do a comparison between 2 simple functions to see if
> they are equivalent but I appear to be running into some problems if
> anyone can help.
>
> The two functions I want to compare are f (g a) and g (f a).
>
> I have f defined and g defined as
>  f :: a -> a
>  f = undefined
>
> g :: a -> a.
> g =  undefined

As you can not say anything about the type of input or output (except that  
they are equal), the only normally terminating function possible is 'id'.  
So, if you don't want to use 'undefined' or 'error', f and g are equal.

Regards,
Henk-Jan van Tuyl


-- 
Folding at home
What if you could share your unused computer power to help find a cure? In  
just 5 minutes you can join the world's biggest networked computer and get  
us closer sooner. Watch the video.
http://folding.stanford.edu/


http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--


More information about the Beginners mailing list