mirror of
https://github.com/iritmaximus/haskell.git
synced 2026-10-12 19:13:39 +03:00
ex8, whileRight done
This commit is contained in:
+3
-1
@@ -169,7 +169,9 @@ while check update value = if check value then while check update (update value)
|
||||
-- Hint! Remember the case-of expression from lecture 2.
|
||||
|
||||
whileRight :: (a -> Either b a) -> a -> b
|
||||
whileRight check x = todo
|
||||
whileRight check x = case check x of
|
||||
Left value -> value
|
||||
Right x -> whileRight check x
|
||||
|
||||
-- for the whileRight examples:
|
||||
-- step k x doubles x if it's less than k
|
||||
|
||||
Reference in New Issue
Block a user