@@ -99,7 +99,7 @@ ctorToType env (name, tvars, ctors) =
9999get :: Environment -> (Environment -> Map.Map String a) -> String -> a
100100get env subDict key = Map.findWithDefault err key (subDict env)
101101 where
102− err = error $ "Could not find type constructor '" ++ key ++ "' while checking types."
102+ err = error $ "\nCould not find type constructor '" ++ key ++ "' while checking types."
103103
104104
105105freshDataScheme :: Environment -> String -> IO (Int, [Variable], [Type], Type)
@@ -146,9 +146,11 @@ instantiator env sourceType = go sourceType
146146 Just t -> return $ foldl (<|) t ts'
147147 Nothing ->
148148 case Map.lookup name (aliases env) of
149− Nothing -> error $ "Could not find type constructor '" ++ name ++ "' while checking types."
149+ Nothing -> error $ "\nCould not find type constructor '" ++ name ++ "' while checking types."
150150 Just (tvars, t) ->
151− let msg = "Type alias '" ++ name ++ "' expects " ++ show (length tvars) ++
151+ let tvarLen = length tvars
152+ msg = "\nType alias '" ++ name ++ "' expects " ++ show tvarLen ++
153+ " type argument" ++ (if tvarLen == 1 then "" else "s") ++
152154 " but was given " ++ show (length ts')
153155 in if length ts' /= length tvars then error msg else
154156 do (dict, aliases) <- State.get