









































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










































Andrew Black and Tim Sheard Lecture 2 Intro to Haskell
Characteristics of Haskell
___ ___ _ / _ \ /\ // () / /// // / / | | GHC Interactive, version 6.4.1, for Haskell 98. / /\/ __ / /| | http://www.haskell.org/ghc/ _// //__/|| Type :? for help. Loading package base-1.0 ... linking ... done. Prelude> length [1,2,3,4] 4 Prelude> In addition to the command-line compiler, GHC also comes with an interactive environment, GHCI, it works much like Hugs (after which it was modeled). Try it out!
**__ __ __ __ ____ ___
|| || || || || || ||__ Hugs 98: Based Haskell 98 standard |||| |||| ||_|| __|| Copyright (c) 1994- ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Report bugs to: [email protected] || || Version: Nov 2003
Hugs mode: Restart with command line option +98 for Haskell 98 mode Hugs session for: C:\Program Files\Hugs98/libraries\Hugs\Prelude.hs C:\Program Files\Hugs98/libraries\Prelude.hs D:\work\sheard\Courses\CSE502\Fall2004\lect01.html Type :? for help Main>** Hugs Demo
data IntList = Cons Int IntList | Nil len Nil = 0 len (Cons x xs) = 1 + len xs addAll Nil = 0 addAll (Cons x xs) = x + addAll xs Define some data Write some functions
Node Node Node 3 Tip 6 Tip 14 Tip 8 Tip