Skip to content

Commit

Permalink
Function composition fix (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarekSuchanek committed Jul 7, 2018
1 parent 52765d6 commit db5a796
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tutorials/01_fp-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,10 @@ isTriangle :: Double -> Double -> Double -> Bool
Now we can add another function to the file:

```haskell
-- Added function
conforms :: Integer -> Bool
conforms x = (x > 10 && x < 15) || x == 0
-- . is function composition (as in math)
isntTriangle = not . isTriangle
notConforms = not . conforms
```

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`.
Expand All @@ -334,7 +335,8 @@ Ok, modules loaded: Main.
*Main> :browse
linear :: Integer -> Integer -> Integer -> Integer
isTriangle :: Double -> Double -> Double -> Bool
isntTriangle :: Double -> Double -> Double -> Bool
conforms :: Integer -> Bool
notConforms :: Integer -> Bool
```

## First project
Expand Down

0 comments on commit db5a796

Please sign in to comment.