Skip to content

Instantly share code, notes, and snippets.

@tarquin-the-brave
Created May 12, 2020 13:30
Show Gist options
  • Select an option

  • Save tarquin-the-brave/5c114b6a5cec992a32ce1fb5c471d28f to your computer and use it in GitHub Desktop.

Select an option

Save tarquin-the-brave/5c114b6a5cec992a32ce1fb5c471d28f to your computer and use it in GitHub Desktop.
maybePos :: Int -> Maybe Int
maybePos x
| x < 0 = Nothing
| otherwise = Just x
thing :: Int -> [Int]
thing x = case maybePos x of
Nothing -> []
Just posX -> [posX]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment