jacinda 3.0.1.0 → 3.0.1.1
raw patch · 8 files changed
+22/−17 lines, 8 files
Files
- CHANGELOG.md +7/−0
- examples/tags.jac +1/−1
- jacinda.cabal +1/−1
- src/A/I.hs +1/−1
- src/File.hs +8/−10
- src/Jacinda/Backend/T.hs +1/−0
- src/Ty.hs +1/−1
- x/Main.hs +2/−3
CHANGELOG.md view
@@ -1,3 +1,10 @@+# 3.0.1.1++ * Fix bug with tuples in implicit contexts.+ * `fp` is defined (as `(stdin)`) when reading from stdin+ * Bug in row typing for fields where `->0` is treated as legitimate and fails+ with unclear error at runtime+ # 3.0.1.0 * Add `,,` (bookend)
examples/tags.jac view
@@ -4,7 +4,7 @@ fn processStr(s) := let val line := split s /[ \(:]+/- val outLine := sprintf '%s\t%s\t%s' (line.2 . fp . mkEx s)+ val outLine := sprintf '%s\t%s\t%s' (line.3 . fp . mkEx s) in outLine end; processStr¨{%/fn +[[:lower:]][[:latin:]]*.*:=/}{`0}
jacinda.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: jacinda-version: 3.0.1.0+version: 3.0.1.1 license: AGPL-3.0-only license-file: COPYING maintainer: vamchale@gmail.com
src/A/I.hs view
@@ -7,7 +7,7 @@ ) where import A-import Control.Monad.State.Strict (State, evalState, gets, modify, runState, state)+import Control.Monad.State.Strict (State, gets, modify, runState, state) import Data.Bifunctor (second) import Data.Foldable (traverse_) import qualified Data.IntMap as IM
src/File.hs view
@@ -1,6 +1,6 @@ module File ( tcIO , tySrc- , runOnHandle+ , runStdin , runOnFile , exprEval ) where@@ -10,7 +10,6 @@ import A.I import Control.Applicative ((<|>)) import Control.Exception (Exception, throw, throwIO)-import Control.Monad ((<=<)) import Control.Monad.IO.Class (liftIO) import Control.Monad.State.Strict (StateT, get, put, runState, runStateT) import Control.Recursion (cata, embed)@@ -34,7 +33,7 @@ import Parser.Rw import R import Regex.Rure (RurePtr)-import System.IO (Handle)+import System.IO (stdin) import Ty parseLib :: [FilePath] -> FilePath -> StateT AlexUserState IO [D AlexPosn]@@ -108,13 +107,12 @@ Nothing -> cont $ fmap BSL.toStrict (ASCIIL.lines contents) Just rs -> cont $ lazySplit (tcompile rs) contents -runOnHandle :: [FilePath]- -> T.Text -- ^ Program- -> Maybe T.Text -- ^ Field separator- -> Maybe T.Text -- ^ Record separator- -> Handle- -> IO ()-runOnHandle is src cliFS cliRS = runOnBytes is "(runOnBytes)" src cliFS cliRS <=< BSL.hGetContents+runStdin :: [FilePath]+ -> T.Text -- ^ Program+ -> Maybe T.Text -- ^ Field separator+ -> Maybe T.Text -- ^ Record separator+ -> IO ()+runStdin is src cliFS cliRS = runOnBytes is "(stdin)" src cliFS cliRS =<< BSL.hGetContents stdin runOnFile :: [FilePath] -> T.Text
src/Jacinda/Backend/T.hs view
@@ -201,6 +201,7 @@ κ e@RC{} _ = e κ e@Var{} _ = e κ (Lam t n e) line = Lam t n (κ e line)+κ (Tup ty es) line = Tup ty ((`κ` line)<$>es) ni t=IM.singleton t Nothing na=IM.alter go where go Nothing = Just Nothing; go x@Just{} = x
src/Ty.hs view
@@ -128,7 +128,7 @@ mgu l s (TyArr t0 t1) (TyArr t0' t1') = do {s0 <- mguPrep l s t0 t0'; mguPrep l s0 t1 t1'} mgu l s (t0:$t1) (t0':$t1') = do {s0 <- mguPrep l s t0 t0'; mguPrep l s0 t1 t1'} mgu l s (TyTup ts) (TyTup ts') | length ts == length ts' = zS (mguPrep l) s ts ts'-mgu l s (Rho n rs) t'@(TyTup ts) | length ts >= fst (IM.findMax rs) = tS_ (\sϵ (i, tϵ) -> IM.insert (unU$unique n) t' <$> mguPrep l sϵ (ts!!(i-1)) tϵ) s (IM.toList rs)+mgu l s (Rho n rs) t'@(TyTup ts) | length ts >= fst (IM.findMax rs) && fst (IM.findMin rs) > 0 = tS_ (\sϵ (i, tϵ) -> IM.insert (unU$unique n) t' <$> mguPrep l sϵ (ts!!(i-1)) tϵ) s (IM.toList rs) mgu l s t@TyTup{} t'@Rho{} = mgu l s t' t mgu l s (Rho n rs) (Rho n' rs') = do rss <- tS_ (\sϵ (t0,t1) -> mguPrep l sϵ t0 t1) s $ IM.elems $ IM.intersectionWith (,) rs rs'
x/Main.hs view
@@ -8,7 +8,6 @@ import File import Options.Applicative import qualified Paths_jacinda as P-import System.IO (stdin) data Command = TypeCheck !FilePath ![FilePath] | Run !FilePath !(Maybe T.Text) !(Maybe T.Text) !(Maybe FilePath) ![FilePath]@@ -105,8 +104,8 @@ run :: Command -> IO () run (TypeCheck fp is) = tcIO is =<< TIO.readFile fp-run (Run fp fs rs Nothing is) = do { contents <- TIO.readFile fp ; runOnHandle is contents fs rs stdin }+run (Run fp fs rs Nothing is) = do { contents <- TIO.readFile fp ; runStdin is contents fs rs } run (Run fp fs rs (Just dat) is) = do { contents <- TIO.readFile fp ; runOnFile is contents fs rs dat }-run (Expr eb Nothing fs a u rs is) = let (fs',rs') = ap a u fs rs in runOnHandle is eb fs' rs' stdin+run (Expr eb Nothing fs a u rs is) = let (fs',rs') = ap a u fs rs in runStdin is eb fs' rs' run (Expr eb (Just fp) fs a u rs is) = let (fs',rs') = ap a u fs rs in runOnFile is eb fs' rs' fp run (Eval e) = print (exprEval e)