I can get a where clause to work across pattern matches a case statement:
updateHung :: Text -> Maybe Char -> Int
updateHung word got =
let x = case got of
Just l
| elem l . unpack $ word -> pass
| otherwise -> strike
Nothing -> pass
where
strike = 1
pass = 0
in x
But when I try to do the same thing using a multipart function it doesn't work:
updateHung :: Text -> Maybe Char -> Int
updateHung word (Just l)
| elem l . unpack $ word = pass
| otherwise = strike
updateHung word Nothing = pass
where
strike = 1
pass = 0
Is there some way to get this to work?