Author Anonymous
 Title (undefined)
 Created at Fri Apr 17 21:48:40 UTC 2015
-- this compiles fine
nullLiteral :: Parser String
nullLiteral = do
  result <- try (string "null")
  return ("hello" ++ result)

-- this gives an error (below)
nullLiteral' :: Parser String
nullLiteral' = (try (string "null")) >= (\result -> return ("hello" ++ result))

-- src/Main.hs:69:16:
--     Couldn't match type ‘Bool’
--                   with ‘ParsecT
--                           String
--                           ()
--                           transformers-0.3.0.0:Data.Functor.Identity.Identity
--                           String’
--     Expected type: Parser String
--       Actual type: Bool
--     In the expression:
--       (try (string "null")) >= (\ result -> return ("hello" ++ result))
--     In an equation for ‘nullLiteral'’:
--         nullLiteral'
--           = (try (string "null")) >= (\ result -> return ("hello" ++ result))

-- src/Main.hs:69:42:
--     Couldn't match expected type ‘[Char] -> m1 [Char]’
--                 with actual type ‘ParsecT s0 u0 m0 String’
--     The lambda expression ‘\ result -> return ("hello" ++ result)’
--     has one argument,
--     but its type ‘ParsecT s0 u0 m0 String’ has none
--     In the second argument of ‘(>=)’, namely
--       ‘(\ result -> return ("hello" ++ result))’
--     In the expression:
--       (try (string "null")) >= (\ result -> return ("hello" ++ result))
-- Failed, modules loaded: none.
Result
Not in scope: type constructor or class ‛Parser’
Not in scope: type constructor or class ‛Parser’
Not in scope: ‛try’
Perhaps you meant ‛tri’ (imported from Diagrams.Prelude)
Not in scope: ‛string’
Perhaps you meant ‛during’ (imported from Diagrams.Prelude)
Not in scope: ‛try’
Perhaps you meant ‛tri’ (imported from Diagrams.Prelude)
Not in scope: ‛string’
Perhaps you meant ‛during’ (imported from Diagrams.Prelude)