Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

One way of solving some exercises

NotificationsYou must be signed in to change notification settings

FACSKELL/Lecture-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FACSKELL is the Founders & Coders Haskell Club. We are currently learning Haskell by readingCIS 194: Introduction to Haskell (Spring 2013) byBrent Yorgey. We are also learning from other books:

Find and post your questions onReddit Haskell,Reddit Haskell Questions or onStackoverflow

For a more detail list of documentation you can have a look at theHaskell website

Why

Because learning Haskell is cool!

What is Haskell

Haskell is:

  • Functional
  • Pure
    • Immutable
    • No side effects
    • A same function with the same arguments will return the same outputs
  • Lazy
  • Typed

Types

Haskell has the usual types : Bool, Int, Integer, Char, String. The Char type is represented with single quote 'C', the Sting type is represented with double quotes "myString". Haskell has also some more useful types:

  • Pairs:
p:: (Int,Char)
  • List:
l:: [Integer]-- a list is a head and a tail (x:xs)

Alias type

You can use the keywordtype to create an alias for a type.

typeSt=Stringf::St->St

Algebraic Data Type

You can create a new type with the keyworddata:

dataTree=Empty |LeafInt |NodeTreeTree

Here we create thetype constructor Tree whith the followingdata constructors:

  • Empty
  • Leaf Int
  • Node Tree Tree

Leaf and Node take parameters!type constructor and data constructor must begin with a capital letter!

Combining functions

You can combine functions:

 myOtherFunc (myFirstFunc a)

Two useful operators:

. Which correspond to the mathematic composition. The result of the fist function become the input of the second function

(myOtherFunc. myFirstFunc) a

$ Replace parenthesis. Everything after $ will be executed before the things before the $ (everything after $ has a higher precedence)

myOtherFunc$ myFirstFunc a

Haskell load by default the Prelude module which contains a lot of useful functions

You can find all the documentation of Haskell on Hoogle

About

One way of solving some exercises

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp