packages feed

purescript 0.4.19.1 → 0.4.20

raw patch · 4 files changed

+50/−35 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

docgen/Main.hs view
@@ -26,16 +26,21 @@ import System.Console.CmdTheLine import System.Exit (exitSuccess, exitFailure) -docgen :: FilePath -> IO ()-docgen input = do+docgen :: Bool -> [FilePath] -> IO ()+docgen showHierarchy input = do+  ms <- mapM parseFile (nub input)+  U.putStrLn . runDocs $ (renderModules showHierarchy) (concat ms)+  exitSuccess++parseFile :: FilePath -> IO [P.Module]+parseFile input = do   text <- U.readFile input   case P.runIndentParser input P.parseModules text of     Left err -> do       U.print err       exitFailure     Right ms -> do-      U.putStrLn . runDocs $ renderModules ms-      exitSuccess+      return ms  type Docs = Writer [String] () @@ -53,37 +58,45 @@   let ls = lines text in   forM_ ls $ \l -> tell [replicate indent ' ' ++ l] -renderModules :: [P.Module] -> Docs-renderModules ms = do+renderModules :: Bool -> [P.Module] -> Docs+renderModules showHierarchy ms = do   headerLevel 1 "Module Documentation"-  mapM_ renderModule ms+  spacer+  mapM_ (renderModule showHierarchy) ms -renderModule :: P.Module -> Docs-renderModule (P.Module moduleName ds exps) =+renderModule :: Bool -> P.Module -> Docs+renderModule showHierarchy (P.Module moduleName ds exps) =   let exported = filter (isExported exps) ds+      hasTypes = any isTypeDeclaration ds       hasTypeclasses = any isTypeClassDeclaration ds+      hasTypeclassInstances = any isTypeInstanceDeclaration ds+      hasValues = any isValueDeclaration ds   in do     headerLevel 2 $ "Module " ++ P.runModuleName moduleName     spacer-    headerLevel 3 "Types"-    spacer-    renderTopLevel exps (filter isTypeDeclaration exported)-    spacer-    headerLevel 3 "Type Classes"-    spacer+    when hasTypes $ do+      headerLevel 3 "Types"+      spacer+      renderTopLevel exps (filter isTypeDeclaration exported)+      spacer     when hasTypeclasses $ do-      renderTypeclassImage moduleName+      headerLevel 3 "Type Classes"       spacer-    renderTopLevel exps (filter isTypeClassDeclaration exported)-    spacer-    headerLevel 3 "Type Class Instances"-    spacer-    renderTopLevel exps (filter isTypeInstanceDeclaration ds)-    spacer-    headerLevel 3 "Values"-    spacer-    renderTopLevel exps (filter isValueDeclaration exported)-    spacer+      when showHierarchy $ do+        renderTypeclassImage moduleName+        spacer+      renderTopLevel exps (filter isTypeClassDeclaration exported)+      spacer+    when hasTypeclassInstances $ do+      headerLevel 3 "Type Class Instances"+      spacer+      renderTopLevel exps (filter isTypeInstanceDeclaration ds)+      spacer+    when hasValues $ do+      headerLevel 3 "Values"+      spacer+      renderTopLevel exps (filter isValueDeclaration exported)+      spacer  isExported :: Maybe [P.DeclarationRef] -> P.Declaration -> Bool isExported Nothing _ = True@@ -98,6 +111,7 @@   matches (P.TypeSynonymDeclaration ident _ _) (P.TypeRef ident' _) = ident == ident'   matches (P.TypeClassDeclaration ident _ _ _) (P.TypeClassRef ident') = ident == ident'   matches (P.PositionedDeclaration _ d) r = d `matches` r+  matches d (P.PositionedDeclarationRef _ r) = d `matches` r   matches _ _ = False  isDctorExported :: P.ProperName -> Maybe [P.DeclarationRef] -> P.ProperName -> Bool@@ -182,11 +196,14 @@ isTypeInstanceDeclaration (P.PositionedDeclaration _ d) = isTypeInstanceDeclaration d isTypeInstanceDeclaration _ = False -inputFile :: Term FilePath-inputFile = value $ pos 0 "input.ps" $ posInfo { posDoc = "The input .ps file" }+inputFiles :: Term [FilePath]+inputFiles = value $ posAny [] $ posInfo { posName = "file(s)", posDoc = "The input .purs file(s)" } +includeHeirarcy :: Term Bool+includeHeirarcy = value $ flag $ (optInfo [ "h", "hierarchy-images" ]) { optDoc = "Include markdown for type class hierarchy images in the output." }+ term :: Term (IO ())-term = docgen <$> inputFile+term = docgen <$> includeHeirarcy <*> inputFiles  termInfo :: TermInfo termInfo = defTI
psci/Main.hs view
@@ -257,10 +257,10 @@     P.Module moduleName ((importDecl `map` imports) ++ decls) Nothing  modulesDir :: FilePath-modulesDir = "psci_modules" ++ pathSeparator : "node_modules"+modulesDir = ".psci_modules" ++ pathSeparator : "node_modules"  indexFile :: FilePath-indexFile = "psci_modules" ++ pathSeparator : "index.js"+indexFile = ".psci_modules" ++ pathSeparator : "index.js"  -- | -- Takes a value declaration and evaluates it with the current state.
purescript.cabal view
@@ -1,5 +1,5 @@ name: purescript-version: 0.4.19.1+version: 0.4.20 cabal-version: >=1.8 build-type: Custom license: MIT@@ -8,7 +8,7 @@ maintainer: Phil Freeman <paf31@cantab.net> stability: experimental synopsis: PureScript Programming Language Compiler-description: A small compile-to-JS language with extensible records and type-safe blocks+description: A small strongly, statically typed programming language with expressive types, inspired by Haskell and compiling to Javascript. category: Language Homepage: http://www.purescript.org/ author: Phil Freeman <paf31@cantab.net>,
src/Language/PureScript/TypeChecker/Types.hs view
@@ -421,8 +421,6 @@ -- Check that two types unify -- unifiesWith :: Environment -> Type -> Type -> Bool-unifiesWith _ (TUnknown _) _ = True-unifiesWith _ _ (TUnknown _) = True unifiesWith _ (Skolem _ s1 _) (Skolem _ s2 _) | s1 == s2 = True unifiesWith _ (TypeVar v1) (TypeVar v2) | v1 == v2 = True unifiesWith _ (TypeConstructor c1) (TypeConstructor c2) | c1 == c2 = True