fay 0.24.0.0 → 0.24.0.1
raw patch · 15 files changed
+67/−37 lines, 15 filesdep ~aesondep ~basedep ~base-compatPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: aeson, base, base-compat, haskell-src-exts, language-ecmascript, shakespeare, tasty, time, transformers
API changes (from Hackage documentation)
+ Fay.Types: instance Data.Semigroup.Semigroup Fay.Types.CompileWriter
- Fay.Compiler: compileWith :: Monoid a => FilePath -> (a -> Module -> Compile a) -> (FilePath -> String -> Compile a) -> (X -> Module -> IO (Either CompileError Module)) -> String -> Compile (a, CompileState, CompileWriter)
+ Fay.Compiler: compileWith :: (Monoid a, Semigroup a) => FilePath -> (a -> Module -> Compile a) -> (FilePath -> String -> Compile a) -> (X -> Module -> IO (Either CompileError Module)) -> String -> Compile (a, CompileState, CompileWriter)
Files
- CHANGELOG.md +5/−1
- fay.cabal +12/−11
- src/Fay/Compiler/FFI.hs +1/−0
- src/Fay/Compiler/Import.hs +1/−1
- src/Fay/Compiler/Prelude.hs +1/−1
- src/Fay/Types.hs +11/−3
- src/Fay/Types/Printer.hs +11/−3
- src/haskell-names/Language/Haskell/Names/GlobalSymbolTable.hs +7/−3
- src/haskell-names/Language/Haskell/Names/LocalSymbolTable.hs +2/−1
- src/haskell-names/Language/Haskell/Names/ModuleSymbols.hs +3/−5
- src/haskell-names/Language/Haskell/Names/Open/Derived.hs +2/−0
- src/haskell-names/Language/Haskell/Names/Recursive.hs +3/−3
- src/haskell-names/Language/Haskell/Names/SyntaxUtils.hs +1/−0
- src/haskell-names/Language/Haskell/Names/Types.hs +7/−2
- src/tests/Test/Compile.hs +0/−3
CHANGELOG.md view
@@ -2,7 +2,11 @@ See full history at: <https://github.com/faylang/fay/commits> -### 0.24.0.0+#### 0.24.0.1++* Dependency updates incl GHC 8.4 support++## 0.24.0.0 * Add the option to generate typescript output, thanks to Junji Hashimoto.
fay.cabal view
@@ -1,5 +1,5 @@ name: fay-version: 0.24.0.0+version: 0.24.0.1 synopsis: A compiler for Fay, a Haskell subset that compiles to JavaScript. description: Fay is a proper subset of Haskell which is type-checked with GHC, and compiled to JavaScript. It is lazy, pure, has a Fay monad,@@ -139,9 +139,9 @@ Language.Haskell.Names.Types Paths_fay build-depends:- base >= 4.9 && < 4.11- , base-compat >= 0.8 && < 0.10- , aeson > 0.6 && < 1.3+ base >= 4.9 && < 4.12+ , base-compat >= 0.10 && < 0.11+ , aeson > 0.6 && < 1.5 , bytestring >= 0.9 && < 0.11 , containers >= 0.4 && < 0.6 , data-default >= 0.2 && < 0.8@@ -149,8 +149,8 @@ , directory >= 1.1 && < 1.4 , filepath >= 1.3 && < 1.5 , ghc-paths == 0.1.*- , haskell-src-exts >= 1.18.1 && < 1.20- , language-ecmascript >= 0.15 && < 0.18+ , haskell-src-exts == 1.20.*+ , language-ecmascript >= 0.15 && < 0.20 , mtl >= 2.1 && < 2.3 , mtl-compat >= 0.1 && < 0.3 , process >= 1.1 && < 1.7@@ -160,15 +160,15 @@ , spoon >= 0.1 && < 0.4 , syb >= 0.3 && < 0.8 , text >= 0.11 && < 1.3- , time >= 1.4 && < 1.9- , transformers >= 0.3 && < 0.4 || > 0.4.1 && < 0.7- , transformers-compat >= 0.3 && < 0.6+ , time >= 1.4 && < 1.10+ , transformers >= 0.3 && < 0.6+ , transformers-compat >= 0.3 && < 0.7 , traverse-with-class >= 1.0 && < 1.1 , uniplate >= 1.6.11 && < 1.7 , unordered-containers == 0.2.* , utf8-string >= 0.1 && < 1.1 , vector < 0.13- , shakespeare+ , shakespeare < 2.1 if impl(ghc < 7.8) build-depends: tagged@@ -185,6 +185,7 @@ , split other-modules: Paths_fay+ executable fay-tests ghc-options: -O2 -Wall -threaded -with-rtsopts=-N hs-source-dirs: src/tests@@ -208,7 +209,7 @@ , filepath , haskell-src-exts , random >= 1.0 && < 1.2- , tasty >= 0.9 && < 0.12+ , tasty >= 0.9 && < 1.2 , tasty-hunit >= 0.8 && < 0.11 , tasty-th == 0.1.* , text
src/Fay/Compiler/FFI.hs view
@@ -59,6 +59,7 @@ TyBang _ bt unp t -> TyBang () (unAnn bt) (unAnn unp) <$> rmNewtys t TyWildCard {} -> error "TyWildCard not supported" TyQuasiQuote {} -> error "TyQuasiQuote not supported"+ TyUnboxedSum {} -> error "TyUnboxedSum not supported" compileFFI' :: N.Type -> Compile JsExp compileFFI' sig = do
src/Fay/Compiler/Import.hs view
@@ -34,7 +34,7 @@ -- | Compile a module compileWith- :: Monoid a+ :: (Monoid a, Semigroup a) => FilePath -> (a -> F.Module -> Compile a) -> (FilePath -> String -> Compile a)
src/Fay/Compiler/Prelude.hs view
@@ -39,7 +39,7 @@ import Data.Function (on) import Data.List.Compat import Data.Maybe-import Data.Monoid (Monoid (..), (<>))+import Data.Monoid (Monoid (..)) import Data.Ord import Data.Traversable import Prelude.Compat hiding (exp, mod)
src/Fay/Types.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE TypeFamilies #-} -- | All Fay types and instances.@@ -40,6 +41,8 @@ , mkModulePathFromQName ) where +import Fay.Compiler.Prelude+ import Fay.Compiler.ModuleT import Fay.Config import qualified Fay.Exts.NoAnnotation as N@@ -56,10 +59,11 @@ #endif import Control.Monad.Except (ExceptT, MonadError) import Control.Monad.Identity (Identity)-import Control.Monad.RWS+import Control.Monad.RWS (MonadIO, MonadReader, MonadState, MonadWriter, RWST, lift) import Data.Map (Map) import Data.Set (Set) import Language.Haskell.Names (Symbols)+import Data.Semigroup (Semigroup) -------------------------------------------------------------------------------- -- Compiler types@@ -87,10 +91,14 @@ } deriving (Show) -- | Simple concatenating instance.+instance Semigroup CompileWriter where+ (CompileWriter a b c) <> (CompileWriter x y z) =+ CompileWriter (a++x) (b++y) (c++z)++-- | Simple concatenating instance. instance Monoid CompileWriter where mempty = CompileWriter [] [] []- mappend (CompileWriter a b c) (CompileWriter x y z) =- CompileWriter (a++x) (b++y) (c++z)+ mappend = (<>) -- | Configuration and globals for the compiler. data CompileReader = CompileReader
src/Fay/Types/Printer.hs view
@@ -16,12 +16,15 @@ , mapping ) where -import Control.Monad.RWS+import Fay.Compiler.Prelude++import Control.Monad.RWS (RWS, asks, execRWS, get, modify, put, tell) import Data.List (elemIndex) import Data.Maybe (fromMaybe) import Data.String import Language.Haskell.Exts import SourceMap.Types+import qualified Data.Semigroup as SG -- | Global options of the printer data PrintReader = PrintReader@@ -43,10 +46,13 @@ pwOutputString :: PrintWriter -> String pwOutputString (PrintWriter _ out) = out "" +instance SG.Semigroup PrintWriter where+ (PrintWriter a b) <> (PrintWriter x y) = PrintWriter (a ++ x) (b . y)+ -- | Output concatenation instance Monoid PrintWriter where mempty = PrintWriter [] id- mappend (PrintWriter a b) (PrintWriter x y) = PrintWriter (a ++ x) (b . y)+ mappend = (<>) -- | The state of the pretty printer. data PrintState = PrintState@@ -67,10 +73,12 @@ execPrinter :: Printer -> PrintReader -> PrintWriter execPrinter (Printer p) r = snd $ execRWS p r defaultPrintState +instance SG.Semigroup Printer where+ (Printer p) <> (Printer q) = Printer (p >> q) instance Monoid Printer where mempty = Printer $ return ()- mappend (Printer p) (Printer q) = Printer (p >> q)+ mappend = (<>) -- | Print some value. class Printable a where
src/haskell-names/Language/Haskell/Names/GlobalSymbolTable.hs view
@@ -1,5 +1,6 @@ {-# OPTIONS -fno-warn-name-shadowing #-} {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE NoImplicitPrelude #-} -- | This module is designed to be imported qualified. module Language.Haskell.Names.GlobalSymbolTable ( Table@@ -21,6 +22,7 @@ import qualified Data.Map as Map import qualified Data.Set as Set import Language.Haskell.Exts as HSE+import Data.Semigroup (Semigroup) -- | Global symbol table — contains global names data Table =@@ -35,9 +37,8 @@ tyLens :: Lens Table (Map.Map GName (Set.Set (SymTypeInfo OrigName))) tyLens = lens (\(Table _ ts) -> ts) (\ts (Table vs _) -> Table vs ts) -instance Monoid Table where- mempty = empty- mappend (Table vs1 ts1) (Table vs2 ts2) =+instance Semigroup Table where+ (Table vs1 ts1) <> (Table vs2 ts2) = Table (j vs1 vs2) (j ts1 ts2) where j :: (Ord i, Ord k)@@ -45,6 +46,9 @@ -> Map.Map k (Set.Set i) -> Map.Map k (Set.Set i) j = Map.unionWith Set.union+instance Monoid Table where+ mempty = empty+ mappend = (<>) toGName :: QName l -> GName toGName (UnQual _ n) = GName "" (nameToString n)
src/haskell-names/Language/Haskell/Names/LocalSymbolTable.hs view
@@ -14,10 +14,11 @@ import qualified Data.Map as Map import Language.Haskell.Exts+import Data.Semigroup () -- | Local symbol table — contains locally bound names newtype Table = Table (Map.Map NameS SrcLoc)- deriving Monoid+ deriving Semigroup addValue :: SrcInfo l => Name l -> Table -> Table addValue n (Table vs) =
src/haskell-names/Language/Haskell/Names/ModuleSymbols.hs view
@@ -1,4 +1,5 @@ {-# OPTIONS -fno-warn-name-shadowing #-}+{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ViewPatterns #-} module Language.Haskell.Names.ModuleSymbols@@ -7,6 +8,8 @@ ) where +import Fay.Compiler.Prelude+ import Language.Haskell.Exts import Language.Haskell.Names.GetBound import qualified Language.Haskell.Names.GlobalSymbolTable as Global@@ -14,13 +17,8 @@ import Language.Haskell.Names.SyntaxUtils import Language.Haskell.Names.Types -import Control.Monad-import Data.Data-import Data.Either import Data.Lens.Light import qualified Data.Map as Map-import Data.Maybe-import Data.Monoid import qualified Data.Set as Set -- | Compute module's global table. It contains both the imported entities
src/haskell-names/Language/Haskell/Names/Open/Derived.hs view
@@ -85,3 +85,5 @@ deriveGTraversable ''Unpackedness deriveGTraversable ''ResultSig deriveGTraversable ''InjectivityInfo+deriveGTraversable ''DerivStrategy+deriveGTraversable ''MaybePromotedName
src/haskell-names/Language/Haskell/Names/Recursive.hs view
@@ -1,4 +1,5 @@ {-# OPTIONS -fno-warn-name-shadowing #-}+{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} module Language.Haskell.Names.Recursive@@ -7,6 +8,8 @@ , annotateModule ) where +import Fay.Compiler.Prelude+ import Fay.Compiler.ModuleT import Language.Haskell.Names.Annotated import Language.Haskell.Names.Exports@@ -17,12 +20,9 @@ import Language.Haskell.Names.SyntaxUtils import Language.Haskell.Names.Types -import Control.Monad hiding (forM_) import Data.Data (Data) import Data.Foldable import Data.Graph (flattenSCC, stronglyConnComp)-import Data.Maybe-import Data.Monoid import qualified Data.Set as Set import Language.Haskell.Exts
src/haskell-names/Language/Haskell/Names/SyntaxUtils.hs view
@@ -82,6 +82,7 @@ specialConToString (TupleCon _ Unboxed n) = '#':replicate (n-1) ',' specialConToString (Cons _) = ":" specialConToString (UnboxedSingleCon _) = "#"+specialConToString (ExprHole _) = "_" unCName :: CName l -> Name l unCName (VarName _ n) = n
src/haskell-names/Language/Haskell/Names/Types.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE StandaloneDeriving #-} module Language.Haskell.Names.Types ( Error (..)@@ -36,6 +37,7 @@ import qualified Data.Set as Set import Language.Haskell.Exts import Text.Printf+import qualified Data.Semigroup as SG type ExtensionSet = Set.Set KnownExtension @@ -118,10 +120,13 @@ data Symbols = Symbols (Set.Set (SymValueInfo OrigName)) (Set.Set (SymTypeInfo OrigName)) deriving (Eq, Ord, Show, Data, Typeable) +instance SG.Semigroup Symbols where+ (Symbols s1 t1) <> (Symbols s2 t2) =+ Symbols (s1 <> s2) (t1 <> t2)+ instance Monoid Symbols where mempty = Symbols mempty mempty- mappend (Symbols s1 t1) (Symbols s2 t2) =- Symbols (s1 `mappend` s2) (t1 `mappend` t2)+ mappend = (<>) valSyms :: Lens Symbols (Set.Set (SymValueInfo OrigName)) valSyms = lens (\(Symbols vs _) -> vs) (\vs (Symbols _ ts) -> Symbols vs ts)
src/tests/Test/Compile.hs view
@@ -7,9 +7,6 @@ import Fay import Fay.Compiler.Prelude-#if !MIN_VERSION_base(4,7,0)-import Test.Util (isRight)-#endif import Language.Haskell.Exts import Test.Tasty