'Maybe Int' inside 'Controller s a'

armlesshobo 2018-03-08 17:12:18.341318 UTC

1handleRandomNum :: String -> Controller s a
2handleRandomNum maxNum = do
3 parsedNum <- readMaybe maxNum :: Maybe Int
4 case parsedNum of
5 Just num -> do
6 genNum <- liftIO $ getStdRandom $ randomR (0, num)
7 respond . okJson . encode $ RandomNum 0 maxNum genNum
8 Nothing -> respond $ responseLBS status400 [] ""