1.factorial n = foldl (*) 1 [1..n]
Universell verwendbare Bausteine wie:
foldl :: (a->b->a)->a->[b]->a
a->b: function
a:type
[b]:type
a:Ausgabe
2. stack installieren
> stack new MyProject new-template
>cd MyProject
> stack setup
> stack build # projekt kompilieren und ausführen
>stack exec MyProject -exe #somFunc
>stack exec -- ghc Foo.hs # wenn nicht funktioniert ,kann man darunter:
>stack exec -- runghc Foo.hs #nicht compliert .
>stack ghci
auch
GHC installieren:Glasgow Hakell Kompiler(Normaler Kompiler)
ghci(Interpreter Modus)