Everything2
Near Matches
Ignore Exact
Full Text
Everything2

Haskell

"Haskell" is also a: user

created by CITManual

(thing) by Blackheart (8.2 y) (print)   ?   (I like it!) 1 C! Tue Apr 25 2000 at 15:59:58

A non-strict, pure, statically typed, polymorphic, higher-order, functional programming language which evolved from Miranda and the ML family of semi-functional languages. Haskell has an advanced type system which, in addition to the parametrizable algebraic datatypes familiar from ML, allows overloading via type classes, both on type constants and type constructors. It supports imperative constructs such as destructive update and exceptions via the notion of monads.

The major compiler implementations are the Glasgow Haskell Compiler (GHC), the Haskell B. Compiler (HBC) and NHC. Hugs is a Haskell interpreter suitable for small platforms. Hugs and GHC will soon be interoperable.

Other notable features of the Haskell language or its implementations include garbage collection, type inference, the pioneering COM/CORBA foreign function interface embodied in H/Direct and GreenCard, extensions such as multi-parameter type classes and second-order polymorphism, lazy evaluation, extensible infix syntax and layout syntax (as in Python).


(idea) by Rikmeister (4.4 mon) (print)   ?   (I like it!) 2 C!s Tue Mar 02 2004 at 22:01:15

Haskell is a functional programming language created circa 1992, and is today used largely by universities as a theoretical language to be used as a learning tool, and by software engineers in order to prototype a program which will then be written in other languages, such as Java and C++. This is a shame, since Haskell is actually a wonderful language to work in. Since it was not designed along the C strand of language (like Java and C++), it is less reliant on syntax, which means that there is less bracketing issues, and no semicolons at the ends of lines. This also means that it is a lot more readable to the lay person. For example:

greeter::String->String
greeter input = 
    if all valid input then 
        "Hello " ++ input

In the above example, we have defined a function called greeter, which takes in a string of characters (a.k.a a word or a sentence) and returns the same string preceded by the word "Hello" and a space. Typically, you would type your name in. In the above example, I have pattern matched the input string to the word input. I have then used a built in function, all, to run each character of the string through the function valid, which would be defined later. In this way, programs can be evolved in a functional way, so that one can work through the program in a logical way, without having to plan too far ahead, you just have to work out what you want to take in, and what you want to be returned, and then define functions to help you along the way. You can even define dummy functions:

dummy::Integer->String
dummy input = undefined

This means that you can compile the program to check that it works so far, but without having done all of the work yet. The other way of doing this is splitting the program up into reusable modules, which are compiled separately, so that you can fully compile one working part, and use it wherever you like, whilst working on another part. The language can also be quite mathematical, for example:

shapes::String->String
shapes input = 
    if all valid input then
    "Area " ++  show totalArea ++ ", centre " ++ showp totalCentre
    else "Invalid : Program needs valid input in order to run"
        where
        totalArea = areaOf shapeList
        totalCentre= centreOf shapeList
        shapeList = turnToShapes input

The use of the 'where' block allows equations to be formed, which can then be defined later, in this case, using library functions, such as all and show and functions which are defined elsewhere, such as turnToShapes, areaOf, showp, valid and centreOf.


Haskell programs tend to be quite a lot shorter than, for example, Java programs for these reasons. One disadvantage of Haskell is that the input output is quite odd, but for this reason, compilers like ghci and hugs have been written which are able to run the program interactively, i.e. handling the IO themselves so that you don't have to. Another disadvantage is that EMACS, many programmers text editor of choice, needs a patch in order to run Haskell mode properly (i.e. syntax highlighting etc.)


In all, I find Haskell a refreshing language to code in, it teaches you how to think, and makes subsequent programming in other languages much easier


printable version
chaos

World's most flexible programming language currying functions ML monad
People with programming languages named after them Perl as a functional language Prolog ::
Haskell B. Curry Scheme Miranda cheat codes for vim
Languages in which whitespace is significant Eddie Haskell non-strict The Cult
Tcl C++ functional Mercury
University of Texas loathe GTK+ CORBA
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Things you could have written:
integration by parts
Linkin Park
Ancient Roman Graffiti
Boba Fett wasn't that tough
Tarte Tatin
Everything you just read is bullshit
IMF conditionality
The Goddess of the Black Fan
Mary I
Oh boner, you didn't whiz on Old Glory, did you?
Non-standard analysis
Absinthe
Sitting in the rain at night
New Writeups
fallensparks
George's Marvellous Medicine(thing)
Ctrl Y
cognitive dissonance(fiction)
SharQ
Gone Baby Gone(review)
halfWit
If I could, I'd title this "Freedom"(thing)
Roninspoon
Airline Hero(thing)
Ktistec
Why Women Are Always Cold(person)
doctor wilson
Drug policy reform(thing)
tejasa
Easy Raspberry Cheesecake(recipe)
Joysim
Drug policy reform(idea)
aneurin
Tyburn(place)
niruena
Boiling to death(idea)
artman2003
summer(thing)
doctor wilson
The Silver City and the Silent Sea(log)
Dreamvirus
The Silver City and the Silent Sea(poetry)
Aerobe
A nihilist's soulmate(poetry)
This page courtesy of The Everything Development Company