Solve task 03

This commit is contained in:
Manuel Thalmann 2024-03-14 18:15:35 +01:00
parent 37ba1cb36d
commit 7676005844
2 changed files with 9 additions and 5 deletions

4
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,4 @@
{
"version": "2.0.0"
}

View file

@ -57,7 +57,7 @@ Greet Obi-Wan and Han, each with a phrase like e.g.
"Hello Obi-Wan". Use 'map' and 'first'. "Hello Obi-Wan". Use 'map' and 'first'.
-} -}
greetings :: [String] greetings :: [String]
greetings = error "fixme" greetings = map (\x -> "Hello " ++ firstName x) [han, obiWan]
{- "Setters" {- "Setters"
Values of a record can be changed with the syntax below. Values of a record can be changed with the syntax below.
@ -125,10 +125,10 @@ data MyList a
[1,2,3] as 'MyList' [1,2,3] as 'MyList'
-} -}
list :: MyList Integer list :: MyList Integer
list = list =
Cons Cons
1 1
(Cons (Cons
2 2
(Cons (Cons
3 3
@ -142,8 +142,8 @@ list =
-} -}
data Shape data Shape
= Circle { radius :: Float } = Circle { radius :: Float }
| Rectangle | Rectangle
{ len :: Float { len :: Float
, width :: Float , width :: Float
} }