language-dickinson 1.3.0.3 → 1.3.0.4
raw patch · 15 files changed
+105/−11 lines, 15 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +8/−0
- language-dickinson.cabal +2/−1
- lib/grammar/common.dck +5/−0
- lib/grammar/noun.dck +9/−0
- lib/grammar/verb.dck +9/−0
- lib/noun.dck +1/−0
- man/emd.1 +20/−2
- run/Main.hs +4/−4
- run/REPL.hs +4/−2
- src/Language/Dickinson/File.hs +5/−1
- src/Language/Dickinson/Type.hs +18/−1
- test/Golden.hs +1/−0
- test/data/imports.dck +4/−0
- test/data/imports.pretty +4/−0
- test/data/pathologicalImports.dck +11/−0
CHANGELOG.md view
@@ -1,5 +1,13 @@ # dickinson +## 1.3.0.4++ * Add some libraries for declension and conjugation in English+ * Change `emd fmt` behavior around imports.+ * Manpage example+ * Fix bug where pattern match exhaustiveness checking failed when the+ constructor in question was defined in another file+ ## 1.3.0.3 * Fall back onto `$HOME/.local/share/man/man1` if manpages were not found in
language-dickinson.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: language-dickinson-version: 1.3.0.3+version: 1.3.0.4 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2020 Vanessa McHale@@ -18,6 +18,7 @@ man/emd.1 lib/*.dck prelude/*.dck+ lib/grammar/*.dck extra-source-files: test/data/*.pretty
+ lib/grammar/common.dck view
@@ -0,0 +1,5 @@+%-++tydecl person = First | Second | Third++tydecl number = Singular | Plural
+ lib/grammar/noun.dck view
@@ -0,0 +1,9 @@+; types for noun declension++(:include grammar.common)++%-++tydecl case = Subjective | Objective | DependentPossessive | IndependentPossessive++tydecl gender = Masculine | Feminine | Neuter
+ lib/grammar/verb.dck view
@@ -0,0 +1,9 @@+; https://en.wikipedia.org/wiki/Grammatical_tense#English++(:include grammar.common)++%-++tydecl tense = Present | Past | Future++tydecl mood = Indicative | Subjunctive | Conditional | Imperative
lib/noun.dck view
@@ -33,6 +33,7 @@ (| "valetudinarian") (| "car") (| "head")+ (| "sitophobia") (| "tail") (| "joke") (| "autocracy")
man/emd.1 view
@@ -78,11 +78,29 @@ A vim plugin is available; see .PP https://github.com/vmchale/dickinson/tree/master/vim+.SS CTAGS+.PP+To configure exuberant ctags or universal ctags, put+.IP+.nf+\f[C]+--langdef=DICKINSON+--langmap=DICKINSON:.dck+--regex-DICKINSON=/:def *([[:lower:]][[:alnum:]]+)/\[rs]1/f,function/+--regex-DICKINSON=/tydecl *([[:lower:]][[:alnum:]]+) *=/\[rs]1/t,type/+\f[R]+.fi+.PP+in the project .ctags .SH SHELL COMPLETIONS .PP To get shell completions in your current session:-.PP-\f[C]eval \[dq]$(emd --bash-completion-script emd)\[dq]\f[R]+.IP+.nf+\f[C]+eval \[dq]$(emd --bash-completion-script emd)\[dq]+\f[R]+.fi .PP Put this in your \f[C]\[ti]/.bashrc\f[R] or \f[C]\[ti]/.bash_profile\f[R] to install them.
run/Main.hs view
@@ -18,7 +18,7 @@ data Act = Run !FilePath ![FilePath] | REPL ![FilePath] | Check ![FilePath] ![FilePath]- | Lint ![FilePath]+ | Lint ![FilePath] ![FilePath] | Format !FilePath Bool | Man | Ide !FilePath ![FilePath]@@ -56,7 +56,7 @@ checkP = Check <$> some dckFile <*> includes lintP :: Parser Act-lintP = Lint <$> some dckFile+lintP = Lint <$> some dckFile <*> includes dckFile :: Parser FilePath dckFile = argument str@@ -106,8 +106,8 @@ run (Run fp is) = do { is' <- modIs is ; TIO.putStrLn =<< pipeline is' fp } run (REPL fps) = dickinsonRepl fps run (Check fs i) = do { is' <- modIs i ; traverse_ (validateFile is') fs }-run (Lint fs) = traverse_ warnFile fs+run (Lint fs is) = do { is' <- modIs is ; traverse_ warnFile fs ; traverse_ (patternExhaustivenessFile is') fs } run (Format fp False) = fmtFile fp run (Format fp True) = fmtInplace fp run Man = putStrLn =<< manFind-run (Ide fp is) = do { is' <- modIs is ; validateFile is' fp ; warnFile fp }+run (Ide fp is) = do { is' <- modIs is ; validateFile is' fp ; warnFile fp ; patternExhaustivenessFile is' fp }
run/REPL.hs view
@@ -38,8 +38,8 @@ import Prettyprinter.Render.Text (putDoc) import REPL.Completions import REPL.Save-import System.Console.Haskeline (InputT, completeFilename, defaultSettings, fallbackCompletion,- getInputLine, historyFile, runInputT, setComplete)+import System.Console.Haskeline (InputT, completeFilename, defaultSettings, fallbackCompletion, getInputLine, historyFile, runInputT,+ setComplete) import System.Directory (getHomeDirectory) import System.FilePath ((</>)) import System.Random (newStdGen, randoms)@@ -71,6 +71,8 @@ Just (":help":_) -> showHelp *> loop Just (":save":[fp]) -> saveReplSt fp *> loop Just (":save":_) -> liftIO (putStrLn ":save takes one argument") *> loop+ Just [":l"] -> liftIO (putStrLn "nothing loaded!") *> loop+ Just [":load"] -> liftIO (putStrLn "nothing loaded!") *> loop Just (":l":fs) -> traverse loadFile fs *> loop Just (":load":fs) -> traverse loadFile fs *> loop Just (":r":[fp]) -> loadReplSt fp *> loop
src/Language/Dickinson/File.hs view
@@ -6,6 +6,7 @@ , validateFile , validateAmalgamate , warnFile+ , patternExhaustivenessFile , tcFile , amalgamateRename , amalgamateRenameM@@ -89,7 +90,7 @@ -- | Run some lints warnFile :: FilePath -> IO ()-warnFile = maybeThrowIO . (\x -> checkDuplicates x <|> checkMultiple x <|> checkExhaustive x) . modDefs+warnFile = maybeThrowIO . (\x -> checkDuplicates x <|> checkMultiple x) . modDefs <=< eitherThrowIO . parse <=< BSL.readFile @@ -98,6 +99,9 @@ tcFile :: [FilePath] -> FilePath -> IO () tcFile is = eitherThrowIO . tyRun <=< amalgamateRename is++patternExhaustivenessFile :: [FilePath] -> FilePath -> IO ()+patternExhaustivenessFile is = maybeThrowIO . checkExhaustive <=< amalgamateRename is evalFile :: [FilePath] -> FilePath -> IO T.Text evalFile is fp = (\g -> evalFileGen g is fp) =<< newStdGen
src/Language/Dickinson/Type.hs view
@@ -117,7 +117,24 @@ prettyImport pn (Import _ n) = parens (":include" <+> pn n) instance Pretty (Dickinson a) where- pretty (Dickinson is ds) = concatWith (\x y -> x <> hardline <> hardline <> y) (fmap pretty is <> ["%-"] <> fmap pretty ds)+ pretty (Dickinson [] ds) =+ "%-"+ <> hardline+ <> hardline+ <> concatWith (\x y -> x <> hardline <> hardline <> y) (fmap pretty ds)+ pretty (Dickinson is []) =+ concatWith (\x y -> x <> hardline <> y) (fmap pretty is)+ <> hardline+ <> hardline+ <> "%-"+ pretty (Dickinson is ds) =+ concatWith (\x y -> x <> hardline <> y) (fmap pretty is)+ <> hardline+ <> hardline+ <> "%-"+ <> hardline+ <> hardline+ <> concatWith (\x y -> x <> hardline <> hardline <> y) (fmap pretty ds) prettyLetLeaf :: Pretty t => (t, Expression a) -> Doc b prettyLetLeaf (n, e@MultiInterp{}) = group (brackets (pretty n <^> pretty e))
test/Golden.hs view
@@ -39,6 +39,7 @@ , withDckFile "test/examples/quote.dck" , withDckFile "test/examples/declension.dck" , withDckFile "test/data/refractory.dck"+ , withDckFile "test/data/imports.dck" ] prettyBSL :: Dickinson a -> BSL.ByteString
+ test/data/imports.dck view
@@ -0,0 +1,4 @@+(:include profession)+(:include geography)++%-
+ test/data/imports.pretty view
@@ -0,0 +1,4 @@+(:include profession)+(:include geography)++%-
+ test/data/pathologicalImports.dck view
@@ -0,0 +1,11 @@+(:include grammar.verb)+(:include grammar.noun)++%-++(:def pronoun+ (:lambda x (case, person)+ (:match x+ [(Subjective, First) "I"]+ [(Objective, First) "me"]+ )))