Last active
May 23, 2017 23:40
-
-
Save brailsmt/792a070d8111ff96aea7905be7a888f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lib.hs:18:19: error: | |
• Couldn't match expected type ‘Request’ | |
with actual type ‘m0 Request’ | |
• In the second argument of ‘($)’, namely | |
‘parseRequest (crucible_url ++ "/rest-service/users-v1")’ | |
In the expression: | |
setRequestHeader "Accept" ["application/json"] | |
$ parseRequest (crucible_url ++ "/rest-service/users-v1") | |
In an equation for ‘request’: | |
request | |
= setRequestHeader "Accept" ["application/json"] | |
$ parseRequest (crucible_url ++ "/rest-service/users-v1") | |
Lib.hs:19:13: error: | |
• Ambiguous type variable ‘a0’ arising from a use of ‘httpJSON’ | |
prevents the constraint ‘(Yaml.FromJSON a0)’ from being solved. | |
Probable fix: use a type annotation to specify what ‘a0’ should be. | |
These potential instances exist: | |
instance Yaml.FromJSON Value | |
-- Defined in ‘aeson-1.0.2.1:Data.Aeson.Types.FromJSON’ | |
instance (Yaml.FromJSON a, Yaml.FromJSON b) => | |
Yaml.FromJSON (Either a b) | |
-- Defined in ‘aeson-1.0.2.1:Data.Aeson.Types.FromJSON’ | |
instance Yaml.FromJSON Ordering | |
-- Defined in ‘aeson-1.0.2.1:Data.Aeson.Types.FromJSON’ | |
...plus 24 others | |
...plus 53 instances involving out-of-scope types | |
(use -fprint-potential-instances to see them all) | |
• In a stmt of a 'do' block: resp <- httpJSON request | |
In the expression: | |
do { let request | |
= setRequestHeader "Accept" ... | |
$ parseRequest (crucible_url ++ "/rest-service/users-v1"); | |
resp <- httpJSON request; | |
putStrLn "foo" } | |
In an equation for ‘listReviews’: | |
listReviews (user : date : _) | |
= do { let request = ...; | |
resp <- httpJSON request; | |
putStrLn "foo" } | |
Failed, modules loaded: none. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Lib | |
( | |
listReviews | |
) where | |
import Data.Aeson (Value) | |
import qualified Data.Yaml as Yaml | |
import Network.HTTP.Simple | |
import qualified Data.ByteString.Char8 as S8 | |
crucible_url = "http://crucible.foo.com" | |
listReviews :: [String] -> IO () | |
listReviews [] = putStrLn "Error: Must provide user and date!" | |
listReviews (user:[]) = putStrLn "Error: Must provide date!" | |
listReviews (user:date:_) = do | |
let request = setRequestHeader "Accept" ["application/json"] | |
$ parseRequest (crucible_url ++ "/rest-service/users-v1") | |
resp <- httpJSON request | |
putStrLn "foo" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment