[Haskell-beginners] Haskell type system

informationen informationen at gmx.de
Sun Sep 27 09:32:59 EDT 2009


For the parts you could answer and only the correct answers. 
But every hint would be of great value.  I searched the web and the
haskell wiki, especially
http://www.haskell.org/haskellwiki/Category:Theoretical_foundations,
for further informations, but found none, so if you could point me
to a good tutorial for that kind of question, that would be of help
too. 

>Which parts would like explanations for? All of them?
>
>On Sun, Sep 27, 2009 at 12:22 PM, informationen <informationen at gmx.de> wrote:
>
>  Hi,
>
>  i am trying to understand the Haskell type system. I thought i understood
>  it
>  quite well until i encountered the three following exercises. As you can
>  see, i
>  have the answers already. But i don't understand, why they are correct.
>
>  Could anybody tell me a good place where i could learn how to answers these
>  kind
>  of questions correctly or could give me some explanations, why these
>  answers are
>  correct?
>
>  Any help is highly appreciated.
>
>  Kind regards
>
>  Chris
>  Two functions f and g with the following signatures are given:
>  f :: a -> a
>  g :: b -> c -> b
>
>  A) Give the type of the following expressions:
>
>  1) g [False] True  :: 2) g [] True       :: 3) g (f True)      :: 4) g f  
>            ::
>  Answers:
>
>  1 [Boolean] 2) [a]          3) c -> Bool
>  4) c -> (a -> a)1)  g f 1      
>  B) Which of the following statements is correct?
>
>  2)  g (f 1)         is type correct
>  3)  g . (f 1)       is type correct
>  4)  g . f 1         is type correct
>  5)  (g . f) 1       is type correct
>  6)                  none of the expressions is correct
>
>  Answers:
>  1,2 and 5 are correct.
>
>  C) A function h is given as: h p x = p (f x). Which of the following
>  statements is correct.
>
>  1) h :: a -> b -> a -> b
>  2) h :: (a -> a) -> a -> a
>  3) h :: (a -> b) -> a -> b
>  4) h is equivalent to h' with h' p = p . f
>  5) h is equivalent to h' with h' p = p f
>  5) h is equivalent to h' with h' p x = p f x
>
>  Answers:
>  (I am not sure, if i remember correctly, but 3) and 4) should be
>  correct.)
>
>
>  _______________________________________________
>  Beginners mailing list
>  Beginners at haskell.org
>  http://www.haskell.org/mailman/listinfo/beginners


More information about the Beginners mailing list