[Haskell-beginners] Maybe a and Maybe t

Ivan Uemlianin ivan at llaisdy.com
Mon Jun 1 08:47:19 EDT 2009


Brent Yorgey wrote:
> On Sun, May 31, 2009 at 05:42:44PM +0200, Daniel Fischer wrote:
>   
>> But that has nothing to do with the phenomenon, in the inferred type signatures of 
>> safeSecond and tidySecond, the 'a' resp. 't' are both type variables of kind *.
>> The only difference is that in one case the name supply delivered 'a' and in the other it 
>> delivered 't'.
>>     
>
> I think one source of difference is that ghci tries to maintain type
> variable names from declared type signatures.  So perhaps one of the
> library functions used to define 'safeSecond' has an explicitly
> declared type signature that mentions 'a', and a library function used
> to defined 'tidySecond' has one that mentions 't'.
>   
This sounds like a good answer.  Thanks!  I tried this:

  safe xs = head xs

has inferred type safe :: [a] -> a

  tidy (x:_) = x

has inferred type tidy :: [t] -> t

I can rest easy now, and get on to the next exercise.

Best

Ivan


-- 
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development

                    ivan at llaisdy.com
                     www.llaisdy.com
                         llaisdy.wordpress.com
                     www.linkedin.com/in/ivanuemlianin

    "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
                     (Schiller, Beethoven)
============================================================



More information about the Beginners mailing list