[Haskell-cafe] a bunch of newbie questions

Bulat Ziganshin bulat.ziganshin at gmail.com
Fri Aug 4 06:35:22 EDT 2006


Hello Imam,

Friday, August 4, 2006, 12:19:04 PM, you wrote:

>> (read "56")::Integer

> does it in fact pass the type (Integer) to the
> function (read)?

it tells the compiler that result should be of type Integer. this info
used by compiler to select among the different 'read' instances proper
one. actually, in type inference algorithm, some types are already
known from context (function types if you given type declarations,
types of some results or parameters, types of global variables and
fields in datatypes) and compiler infer types of all other values
using this information

> theoretically is it possible to do a strictness
> analysis without any help from the programmer?

compiler contains such analyzer, it just not so smart as people
writing the program. in the definition

inc n = n+1

compiler infers that function is strict


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list