@@ -50,7 +50,7 @@ import qualified Paths_purescript as Paths
50data ErrorMessage
50data ErrorMessage
51 = UnsupportedModulePath String
51 = UnsupportedModulePath String
52 | InvalidTopLevel
52 | InvalidTopLevel
53− | UnableToParseModule
53+ | UnableToParseModule String
54 | UnsupportedExport
54 | UnsupportedExport
55 | ErrorInModule ModuleIdentifier ErrorMessage
55 | ErrorInModule ModuleIdentifier ErrorMessage
56 deriving Show
56 deriving Show
@@ -109,8 +109,10 @@ printErrorMessage (UnsupportedModulePath s) =
110printErrorMessage InvalidTopLevel =
110printErrorMessage InvalidTopLevel =
111 [ "Expected a list of source elements at the top level." ]
111 [ "Expected a list of source elements at the top level." ]
112−printErrorMessage UnableToParseModule =
112+printErrorMessage (UnableToParseModule err) =
113− [ "The module could not be parsed." ]
113+ [ "The module could not be parsed:"
114printErrorMessage UnsupportedExport =
116printErrorMessage UnsupportedExport =
115 [ "An export was unsupported. Exports can be defined in one of two ways: "
117 [ "An export was unsupported. Exports can be defined in one of two ways: "
116 , " 1) exports.name = ..."
118 , " 1) exports.name = ..."
@@ -530,7 +532,7 @@ bundle :: forall m. (Applicative m, MonadError ErrorMessage m)
530 -> m String
532 -> m String
531bundle inputStrs entryPoints mainModule namespace = do
533bundle inputStrs entryPoints mainModule namespace = do
532 input <- forM inputStrs $ \(ident, js) -> do
534 input <- forM inputStrs $ \(ident, js) -> do
533− ast <- either (const $ throwError $ ErrorInModule ident UnableToParseModule) pure $ parse js (moduleName ident)
535+ ast <- either (throwError . ErrorInModule ident . UnableToParseModule) pure $ parse js (moduleName ident)
534 return (ident, ast)
536 return (ident, ast)
536 let mids = S.fromList (map (moduleName . fst) input)
538 let mids = S.fromList (map (moduleName . fst) input)