packages feed

morte 1.2.1 → 1.3.0

raw patch · 5 files changed

+38/−34 lines, 5 filesdep +microlensdep +microlens-mtldep −lens-family-coredep ~optparse-applicativePVP ok

version bump matches the API change (PVP)

Dependencies added: microlens, microlens-mtl

Dependencies removed: lens-family-core

Dependency ranges changed: optparse-applicative

API changes (from Hackage documentation)

- Morte.Core: Import :: a -> Expr a
+ Morte.Core: Embed :: a -> Expr a

Files

morte.cabal view
@@ -1,5 +1,5 @@ Name: morte-Version: 1.2.1+Version: 1.3.0 Cabal-Version: >=1.8.0.2 Build-Type: Simple License: BSD3@@ -41,7 +41,8 @@         deepseq            >= 1.3.0    && < 1.5  ,         http-client        >= 0.4.0    && < 0.5  ,         http-client-tls    >= 0.2.0    && < 0.3  ,-        lens-family-core   >= 1.0.0    && < 1.3.0,+        microlens          >= 0.2.0.0  && < 0.4  ,+        microlens-mtl      >= 0.1.3.1  && < 0.2  ,         managed            >= 1.0.0    && < 1.1  ,         pipes              >= 4.0.0    && < 4.2  ,         system-filepath    >= 0.3.1    && < 0.5  ,@@ -62,10 +63,10 @@     Hs-Source-Dirs: exec     Main-Is: Main.hs     Build-Depends:-        base                 >= 4        && <  5        ,-        morte                                           ,-        optparse-applicative                <= 0.11.0.1 ,-        text                 >= 0.11.1.0 && <  1.3+        base                 >= 4        && < 5    ,+        morte                                      ,+        optparse-applicative                < 0.12 ,+        text                 >= 0.11.1.0 && < 1.3  Benchmark benchmarks     Type:           exitcode-stdio-1.0
src/Morte/Core.hs view
@@ -239,12 +239,12 @@     | Pi  Text (Expr a) (Expr a)     -- | > App f a        ~  f a     | App (Expr a) (Expr a)-    -- | > Import path    ~  #path-    | Import a+    -- | > Embed path     ~  #path+    | Embed a     deriving (Functor, Foldable, Traversable, Show)  instance Applicative Expr where-    pure = Import+    pure = Embed      mf <*> mx = case mf of         Const c     -> Const c@@ -252,10 +252,10 @@         Lam x _A  b -> Lam x (_A <*> mx) ( b <*> mx)         Pi  x _A _B -> Pi  x (_A <*> mx) (_B <*> mx)         App f a     -> App (f <*> mx) (a <*> mx)-        Import f    -> fmap f mx+        Embed f     -> fmap f mx  instance Monad Expr where-    return = Import+    return = Embed      m >>= k = case m of         Const c     -> Const c@@ -263,7 +263,7 @@         Lam x _A  b -> Lam x (_A >>= k) ( b >>= k)         Pi  x _A _B -> Pi  x (_A >>= k) (_B >>= k)         App f a     -> App (f >>= k) (a >>= k)-        Import r    -> k r+        Embed r     -> k r  lookupN :: Eq a => a -> [(a, b)] -> Int -> Maybe b lookupN a ((a', b'):abs') n | a /= a'   = lookupN a abs'    n@@ -309,7 +309,7 @@             b1 <- go fL fR             b2 <- go aL aR             return (b1 && b2)-        go (Import pL) (Import pR) = return (pL == pR)+        go (Embed pL) (Embed pR) = return (pL == pR)         go _ _ = return False  instance Binary a => Binary (Expr a) where@@ -334,7 +334,7 @@             put (4 :: Word8)             put f             put a-        Import p    -> do+        Embed p     -> do             put (5 :: Word8)             put p @@ -346,7 +346,7 @@             2 -> Lam <$> getUtf8 <*> get <*> get             3 -> Pi  <$> getUtf8 <*> get <*> get             4 -> App <$> get <*> get-            5 -> Import <$> get+            5 -> Embed <$> get             _ -> fail "get Expr: Invalid tag byte"  instance IsString (Expr a)@@ -360,7 +360,7 @@         Lam x _A b  -> rnf x `seq` rnf _A `seq` rnf b         Pi  x _A _B -> rnf x `seq` rnf _A `seq` rnf _B         App f a     -> rnf f `seq` rnf a-        Import p    -> rnf p+        Embed p     -> rnf p  -- | Generates a syntactically valid Morte program instance Buildable a => Buildable (Expr a)@@ -391,7 +391,7 @@                     (if parenApp then "(" else "")                 <>  go True False f <> " " <> go True True a                 <>  (if parenApp then ")" else "")-            Import p   -> build p+            Embed p    -> build p  {-| Bound variable names and their types @@ -493,8 +493,9 @@     App f a       -> App (subst x n e' f) (subst x n e' a)     Var (V x' n') -> if x == x' && n == n' then e' else e     Const k       -> Const k-    -- The Morte compiler enforces that all imports are closed expressions-    Import p      -> Import p+    -- The Morte compiler enforces that all embedded values+    -- are closed expressions+    Embed p       -> Embed p  {-| @shift n x@ adds @n@ to the index of all free variables named @x@ within an     `Expr`@@ -514,8 +515,9 @@           where             n' = if x == x0 && n >= c then n + d else n         Const k     -> Const k-        -- The Morte compiler enforces that all imports are closed expressions-        Import p    -> Import p+        -- The Morte compiler enforces that all embedded values+        -- are closed expressions+        Embed p     -> Embed p  {-| Type-check an expression and return the expression's type if type-checking     suceeds or an error if type-checking fails@@ -562,7 +564,7 @@                 let nf_A  = normalize _A                     nf_A' = normalize _A'                 Left (TypeError ctx e (TypeMismatch nf_A nf_A'))-    Import p    -> absurd p+    Embed p     -> absurd p  {-| `typeOf` is the same as `typeWith` with an empty context, meaning that the     expression must be closed (i.e. no free variables), otherwise type-checking@@ -598,8 +600,9 @@         Var v'      -> v == v'         App f a     -> go f || go a         Const _     -> False-        -- The Morte compiler enforces that all imports are closed expressions-        Import _    -> False+        -- The Morte compiler enforces that all embedded values+        -- are closed expressions+        Embed _     -> False  {-| Reduce an expression to its normal form, performing both beta reduction and     eta reduction@@ -632,7 +635,7 @@         f'         -> App f' (normalize a)     Var   _    -> e     Const _    -> e-    Import p   -> Import p+    Embed p    -> Embed p  -- | Pretty-print a value pretty :: Buildable a => a -> Text
src/Morte/Import.hs view
@@ -89,8 +89,8 @@ import Data.Typeable (Typeable) import Filesystem.Path ((</>)) import Filesystem as Filesystem-import Lens.Family (LensLike')-import Lens.Family.State.Strict (zoom)+import Lens.Micro (Lens')+import Lens.Micro.Mtl (zoom) import Network.HTTP.Client (Manager) import qualified Network.HTTP.Client as HTTP import qualified Network.HTTP.Client.TLS as HTTP@@ -170,13 +170,13 @@     , _manager :: Maybe Manager     } -stack :: Functor f => LensLike' f Status [Path]+stack :: Lens' Status [Path] stack k s = fmap (\x -> s { _stack = x }) (k (_stack s)) -cache :: Functor f => LensLike' f Status (Map Path (Expr X))+cache :: Lens' Status (Map Path (Expr X)) cache k s = fmap (\x -> s { _cache = x }) (k (_cache s)) -manager :: Functor f => LensLike' f Status (Maybe Manager)+manager :: Lens' Status (Maybe Manager) manager k s = fmap (\x -> s { _manager = x }) (k (_manager s))  needManager :: StateT Status Managed Manager
src/Morte/Lexer.x view
@@ -19,7 +19,7 @@ import Data.Word (Word8) import Filesystem.Path.CurrentOS (FilePath) import qualified Filesystem.Path.CurrentOS as Filesystem-import Lens.Family.State.Strict ((.=), (+=))+import Lens.Micro.Mtl ((.=), (+=)) import Pipes (Producer, lift, yield) import Prelude hiding (FilePath) 
src/Morte/Parser.y view
@@ -23,8 +23,8 @@ import qualified Data.Text.Lazy as Text import Data.Text.Lazy.Builder (toLazyText) import Data.Typeable (Typeable)-import Lens.Family.Stock (_1, _2)-import Lens.Family.State.Strict ((.=), use, zoom)+import Lens.Micro (_1, _2)+import Lens.Micro.Mtl ((.=), use, zoom) import Morte.Core (Var(..), Const(..), Path(..), Expr(..)) import qualified Morte.Lexer as Lexer import Morte.Lexer (Token, Position)@@ -73,7 +73,7 @@     : VExpr                                   { Var $1       }     | '*'                                     { Const Star   }     | 'BOX'                                   { Const Box    }-    | Import                                  { Import $1    }+    | Import                                  { Embed $1     }     | '(' Expr ')'                            { $2           }  Import :: { Path }