[Haskell] Re: Probably a trivial thing for people knowing

John Lato jwlato at gmail.com
Mon Oct 20 04:52:01 EDT 2008


Friedrich wrote:
> "Brandon S. Allbery KF8NH" <allbery at ece.cmu.edu> writes:
>
>> On 2008 Oct 19, at 2:26, Friedrich wrote:
>>> Paul Johnson <paul at cogito.org.uk> writes:
>>>>> (By the way, putting in the top level type declarations helps a lot
>>>> when you make a mistake.)
>>> Well I have my problems with that. Probably it comes from using
>>> Languages like Ruby and my special dislike of "typing things" comes
>>> especially from Java, C++ (well C is not "innocent" in that regard
>>> also.
>>
>> Learn to love types:  one of the neat things about Haskell is that if
>> you can write down the type of a function then you have usually done
>> 90% of the work of writing the code for it.
> Well I disagree. But that's another story.
>
>> Another is that in
>> general, if you can't express the type of a function, it means you
>> haven't thought through what you're trying to do.
>
> No  that's not true. The use implies that. However I'm not advice
> resistant and will see if I use types. But IMHO that's should be job
> of the environment  to figure out  correctly and most of the time
> Haskell does "guess" right. And I surely can ask for the types.
>
It's true for people who use Haskell a lot.  The reason is that
Haskell types are fundamentally different from types in C (and
related).  I think it has to do with how you reason about a program's
behavior.  A well-designed Haskell program has types that are
extremely well-suited to the problem domain, and as such the type
often encapsulates everything you need to know about the function.

John Lato


More information about the Haskell mailing list