Skip to content

Commit db5a796

Browse files
Function composition fix (#16)
1 parent 52765d6 commit db5a796

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tutorials/01_fp-env.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,10 @@ isTriangle :: Double -> Double -> Double -> Bool
320320
Now we can add another function to the file:
321321

322322
```haskell
323-
-- Added function
323+
conforms :: Integer -> Bool
324+
conforms x = (x > 10 && x < 15) || x == 0
324325
-- . is function composition (as in math)
325-
isntTriangle = not . isTriangle
326+
notConforms = not . conforms
326327
```
327328

328329
But you need to recompile the file in GHCi so the change can take effect. You can use `:load` again, but if you don't want to write the filename (and path), you can use `:reload`.
@@ -334,7 +335,8 @@ Ok, modules loaded: Main.
334335
*Main> :browse
335336
linear :: Integer -> Integer -> Integer -> Integer
336337
isTriangle :: Double -> Double -> Double -> Bool
337-
isntTriangle :: Double -> Double -> Double -> Bool
338+
conforms :: Integer -> Bool
339+
notConforms :: Integer -> Bool
338340
```
339341

340342
## First project

0 commit comments

Comments
 (0)