language-dickinson 1.1.0.3 → 1.2.0.0
raw patch · 10 files changed
+59/−23 lines, 10 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- README.md +8/−2
- examples/fortune.dck +1/−1
- language-dickinson.cabal +4/−2
- run/Main.hs +3/−6
- src/Data/List/Ext.hs +11/−0
- src/Language/Dickinson/Check/Common.hs +8/−0
- src/Language/Dickinson/Check/Scope.hs +3/−5
- src/Language/Dickinson/Lib.hs +13/−3
- src/Language/Dickinson/Type.hs +3/−4
CHANGELOG.md view
@@ -1,5 +1,10 @@ # dickinson +## 1.2.0.0++ * Remove `dir` subcommand+ * `emd` now looks for libraries in `$HOME/.emd` if extant+ ## 1.1.0.3 * More sensible completions in REPL
README.md view
@@ -4,14 +4,20 @@ ## Installation -### Binaries+### Binary Releases Binaries for some platforms are available on the [releases page](https://github.com/vmchale/dickinson/releases). +Unpack the distribution, then:++```+make install+```+ ### Source -To install, first download [cabal-install](https://www.haskell.org/cabal/) and+To install, get [cabal-install](https://www.haskell.org/cabal/) and [GHC](https://www.haskell.org/ghc/download.html). Then: ```
examples/fortune.dck view
@@ -54,7 +54,7 @@ (''' No more pennies to fill my pockets ''', "Arrow de Wilde"))- ; (| $ quote ("God save the prom queen", "Molly Kate Kestner"))+ (| $ quote ("\"I never made it with moderation.\"", "Florence Welch")) (| $ quote ("« Le beau est ce qu'on désire sans vouloir le manger. »", "Simone Weil")) (| $ quote ("\"You're more likely to get cut with a dull tool than a sharp one.\"", "Fiona Apple")) (| $ quote ("\"You forgot the difference between equanimity and passivity.\"", "Fiona Apple"))
language-dickinson.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: language-dickinson-version: 1.1.0.3+version: 1.2.0.0 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2020 Vanessa McHale@@ -8,7 +8,7 @@ author: Vanessa McHale tested-with: ghc ==8.0.2 ghc ==8.2.2 ghc ==8.4.4 ghc ==8.6.5 ghc ==8.8.4- ghc ==8.10.1+ ghc ==8.10.2 synopsis: A language for generative literature description: Dickinson is a language for generative (random) literature@@ -111,8 +111,10 @@ Paths_language_dickinson Language.Dickinson.Lib.Get Language.Dickinson.Pattern+ Language.Dickinson.Check.Common Control.Monad.Ext Data.Foldable.Ext+ Data.List.Ext autogen-modules: Paths_language_dickinson default-language: Haskell2010
run/Main.hs view
@@ -20,7 +20,6 @@ | Format !FilePath Bool | Man | Ide !FilePath ![FilePath]- | Dir main :: IO () main = run =<< execParser wrapper@@ -33,10 +32,9 @@ <> command "lint" (info lintP (progDesc "Examine a file for common errors.")) <> command "fmt" (info formatP (progDesc "Format Dickinson code")) <> command "man" (info (pure Man) (progDesc "Dump path to manpages"))- <> command "ide" (info ide (progDesc "Run all checks and lints"))- -- ide and dir should be hidden?- <> command "dir" (info (pure Dir) (progDesc "Show library install directory"))- ) <|> runP+ )+ <|> hsubparser (command "ide" (info ide (progDesc "Run all checks and lints")) <> internal)+ <|> runP formatP :: Parser Act formatP = Format@@ -99,4 +97,3 @@ run (Format fp True) = fmtInplace fp run Man = putStrLn . (</> "emd.1") . (</> "man") =<< getDataDir run (Ide fp is) = do { is' <- modIs is ; validateFile is' fp ; warnFile fp }-run Dir = putStrLn =<< getDataDir
+ src/Data/List/Ext.hs view
@@ -0,0 +1,11 @@+module Data.List.Ext ( anyA+ , allA+ ) where++-- TODO: does this short-circuit appropriately with state monad?+anyA :: (Traversable t, Applicative f) => (a -> f Bool) -> t a -> f Bool+anyA p = fmap or . traverse p++-- TODO: does this short-circuit appropriately with state monad?+allA :: (Traversable t, Applicative f) => (a -> f Bool) -> t a -> f Bool+allA p = fmap and . traverse p
+ src/Language/Dickinson/Check/Common.hs view
@@ -0,0 +1,8 @@+module Language.Dickinson.Check.Common ( mapSumM+ ) where++import Control.Applicative (Alternative)+import Data.Foldable (asum)++mapSumM :: (Traversable t, Alternative f, Applicative m) => (a -> m (f b)) -> t a -> m (f b)+mapSumM = (fmap asum .) . traverse
src/Language/Dickinson/Check/Scope.hs view
@@ -5,11 +5,12 @@ , checkScopeDeclWith ) where -import Control.Applicative (Alternative, (<|>))+import Control.Applicative ((<|>)) import Control.Monad.Except (MonadError) import Control.Monad.State (State, evalState, get, modify)-import Data.Foldable (asum, traverse_)+import Data.Foldable (traverse_) import qualified Data.IntSet as IS+import Language.Dickinson.Check.Common import Language.Dickinson.Check.Pattern import Language.Dickinson.Error import Language.Dickinson.Name@@ -97,6 +98,3 @@ let ns = traversePattern p traverse_ insertName ns checkExpr e <* traverse_ deleteName ns--mapSumM :: (Traversable t, Alternative f, Applicative m) => (a -> m (f b)) -> t a -> m (f b)-mapSumM = (fmap asum .) . traverse
src/Language/Dickinson/Lib.hs view
@@ -13,9 +13,19 @@ splitEnv :: String -> [FilePath] splitEnv = splitWhen (== ':') +preludeLibPath :: FilePath -> [FilePath] -> [FilePath]+preludeLibPath fp = (preludeDir :) . (libDir :)+ where preludeDir = fp </> "prelude"+ libDir = fp </> "lib"++homeMod :: IO ([FilePath] -> [FilePath])+homeMod = do+ mHome <- lookupEnv "HOME"+ pure $ case mHome of+ Just h -> preludeLibPath (h </> ".emd")+ Nothing -> id+ defaultLibPath :: IO ([FilePath] -> [FilePath]) defaultLibPath = do datadir <- getDataDir- let preludeDir = datadir </> "prelude"- libDir = datadir </> "lib"- pure $ (preludeDir :) . (libDir :)+ (.) (preludeLibPath datadir) <$> homeMod
src/Language/Dickinson/Type.hs view
@@ -26,9 +26,8 @@ import GHC.Generics (Generic) import Language.Dickinson.Lexer import Language.Dickinson.Name-import Prettyprinter (Doc, Pretty (pretty), align, brackets, colon, concatWith, dquotes,- encloseSep, group, hardline, hsep, indent, lparen, parens, pipe, rangle,- rparen, tupled, vsep, (<+>))+import Prettyprinter (Doc, Pretty (pretty), align, brackets, colon, concatWith, dquotes, encloseSep, group, hardline, hsep, indent,+ line, lparen, parens, pipe, rangle, rparen, tupled, vsep, (<+>)) import Prettyprinter.Internal (unsafeTextWithoutNewlines) data Dickinson a = Dickinson { modImports :: [Import a]@@ -109,7 +108,7 @@ instance Pretty (Declaration a) where pretty (Define _ n e) = parens (":def" <+> pretty n <#> indent 2 (pretty e))- pretty (TyDecl _ n cs) = "tydecl" <+> pretty n <+> "=" <+> concatWith (\x y -> x <+> pipe <+> y) (toList (pretty <$> cs))+ pretty (TyDecl _ n cs) = "tydecl" <+> pretty n <+> align ("=" <+> group (concatWith (\x y -> x <> line <> pipe <+> y) (toList (pretty <$> cs)))) instance Pretty (Import a) where pretty = prettyImport pretty