lab08: init

This commit is contained in:
2026-03-02 11:14:28 -08:00
parent 23b2a4376d
commit 70c88a8ba2
6 changed files with 187 additions and 0 deletions

8
lab08/applyMaybe.hs Normal file
View File

@@ -0,0 +1,8 @@
applyMaybe :: Maybe a -> (a -> Maybe b) -> Maybe b  
applyMaybe Nothing f  = Nothing  
applyMaybe (Just x) f = f x
test1 = Just 3 `applyMaybe` (\x -> Just $ x * 2) `applyMaybe` (\x -> Just $ x - 1)
test2 = Just 3 `applyMaybe` (\_ -> Nothing) `applyMaybe` (\x -> Just $ x - 1)