summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdamBergmark <>2018-06-13 10:59:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-06-13 10:59:00 (GMT)
commit4ebed701710538af34d1679f379ce0aa80346dd4 (patch)
tree3a8f9e3b4ef3bd4eecc633a1b29b39699e8a0e22
parent7a1a5d860848bd006b1a5c1d106f8ab46bcf9638 (diff)
version 0.24.0.1HEAD0.24.0.1master
-rw-r--r--CHANGELOG.md6
-rw-r--r--fay.cabal23
-rw-r--r--src/Fay/Compiler/FFI.hs1
-rw-r--r--src/Fay/Compiler/Import.hs2
-rw-r--r--src/Fay/Compiler/Prelude.hs2
-rw-r--r--src/Fay/Types.hs14
-rw-r--r--src/Fay/Types/Printer.hs14
-rw-r--r--src/haskell-names/Language/Haskell/Names/GlobalSymbolTable.hs10
-rw-r--r--src/haskell-names/Language/Haskell/Names/LocalSymbolTable.hs3
-rw-r--r--src/haskell-names/Language/Haskell/Names/ModuleSymbols.hs8
-rw-r--r--src/haskell-names/Language/Haskell/Names/Open/Derived.hs2
-rw-r--r--src/haskell-names/Language/Haskell/Names/Recursive.hs6
-rw-r--r--src/haskell-names/Language/Haskell/Names/SyntaxUtils.hs1
-rw-r--r--src/haskell-names/Language/Haskell/Names/Types.hs9
-rw-r--r--src/tests/Test/Compile.hs3
15 files changed, 67 insertions, 37 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a8a30ce..6f441b3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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.
diff --git a/fay.cabal b/fay.cabal
index 3ba030c..33e9e98 100644
--- a/fay.cabal
+++ b/fay.cabal
@@ -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 @@ library
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 @@ library
, 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 @@ library
, 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 @@ executable fay
, 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 @@ executable fay-tests
, 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
diff --git a/src/Fay/Compiler/FFI.hs b/src/Fay/Compiler/FFI.hs
index d8c537c..9f3cdb9 100644
--- a/src/Fay/Compiler/FFI.hs
+++ b/src/Fay/Compiler/FFI.hs
@@ -59,6 +59,7 @@ compileFFIExp loc (fmap unAnn -> nameopt) formatstr sig' =
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
diff --git a/src/Fay/Compiler/Import.hs b/src/Fay/Compiler/Import.hs
index 2c90211..025edd3 100644
--- a/src/Fay/Compiler/Import.hs
+++ b/src/Fay/Compiler/Import.hs
@@ -34,7 +34,7 @@ startCompile compileModule filein = do
-- | Compile a module
compileWith
- :: Monoid a
+ :: (Monoid a, Semigroup a)
=> FilePath
-> (a -> F.Module -> Compile a)
-> (FilePath -> String -> Compile a)
diff --git a/src/Fay/Compiler/Prelude.hs b/src/Fay/Compiler/Prelude.hs
index 45f067c..bdbd4d3 100644
--- a/src/Fay/Compiler/Prelude.hs
+++ b/src/Fay/Compiler/Prelude.hs
@@ -39,7 +39,7 @@ import Data.Either
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)
diff --git a/src/Fay/Types.hs b/src/Fay/Types.hs
index 413c5de..ebc2e67 100644
--- a/src/Fay/Types.hs
+++ b/src/Fay/Types.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TypeFamilies #-}
-- | All Fay types and instances.
@@ -40,6 +41,8 @@ module Fay.Types
, mkModulePathFromQName
) where
+import Fay.Compiler.Prelude
+
import Fay.Compiler.ModuleT
import Fay.Config
import qualified Fay.Exts.NoAnnotation as N
@@ -56,10 +59,11 @@ import Control.Applicative
#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 @@ data CompileWriter = CompileWriter
} 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
diff --git a/src/Fay/Types/Printer.hs b/src/Fay/Types/Printer.hs
index 61e3842..d68c1fd 100644
--- a/src/Fay/Types/Printer.hs
+++ b/src/Fay/Types/Printer.hs
@@ -16,12 +16,15 @@ module Fay.Types.Printer
, 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 @@ data PrintWriter = PrintWriter
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 @@ newtype Printer = Printer
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
diff --git a/src/haskell-names/Language/Haskell/Names/GlobalSymbolTable.hs b/src/haskell-names/Language/Haskell/Names/GlobalSymbolTable.hs
index 8d2dfa3..bdff108 100644
--- a/src/haskell-names/Language/Haskell/Names/GlobalSymbolTable.hs
+++ b/src/haskell-names/Language/Haskell/Names/GlobalSymbolTable.hs
@@ -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 Data.Lens.Light
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 @@ valLens = lens (\(Table vs _) -> vs) (\vs (Table _ ts) -> Table vs ts)
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 @@ instance Monoid Table where
-> 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)
diff --git a/src/haskell-names/Language/Haskell/Names/LocalSymbolTable.hs b/src/haskell-names/Language/Haskell/Names/LocalSymbolTable.hs
index bc6ea2a..db52dfc 100644
--- a/src/haskell-names/Language/Haskell/Names/LocalSymbolTable.hs
+++ b/src/haskell-names/Language/Haskell/Names/LocalSymbolTable.hs
@@ -14,10 +14,11 @@ import Language.Haskell.Names.Types
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) =
diff --git a/src/haskell-names/Language/Haskell/Names/ModuleSymbols.hs b/src/haskell-names/Language/Haskell/Names/ModuleSymbols.hs
index 21a441b..dff266e 100644
--- a/src/haskell-names/Language/Haskell/Names/ModuleSymbols.hs
+++ b/src/haskell-names/Language/Haskell/Names/ModuleSymbols.hs
@@ -1,4 +1,5 @@
{-# OPTIONS -fno-warn-name-shadowing #-}
+{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}
module Language.Haskell.Names.ModuleSymbols
@@ -7,6 +8,8 @@ module Language.Haskell.Names.ModuleSymbols
)
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.ScopeUtils
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
diff --git a/src/haskell-names/Language/Haskell/Names/Open/Derived.hs b/src/haskell-names/Language/Haskell/Names/Open/Derived.hs
index c2ecb76..265d618 100644
--- a/src/haskell-names/Language/Haskell/Names/Open/Derived.hs
+++ b/src/haskell-names/Language/Haskell/Names/Open/Derived.hs
@@ -85,3 +85,5 @@ deriveGTraversable ''PatternSynDirection
deriveGTraversable ''Unpackedness
deriveGTraversable ''ResultSig
deriveGTraversable ''InjectivityInfo
+deriveGTraversable ''DerivStrategy
+deriveGTraversable ''MaybePromotedName
diff --git a/src/haskell-names/Language/Haskell/Names/Recursive.hs b/src/haskell-names/Language/Haskell/Names/Recursive.hs
index afe39f9..7d550b9 100644
--- a/src/haskell-names/Language/Haskell/Names/Recursive.hs
+++ b/src/haskell-names/Language/Haskell/Names/Recursive.hs
@@ -1,4 +1,5 @@
{-# OPTIONS -fno-warn-name-shadowing #-}
+{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
module Language.Haskell.Names.Recursive
@@ -7,6 +8,8 @@ module Language.Haskell.Names.Recursive
, 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.ScopeUtils
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
diff --git a/src/haskell-names/Language/Haskell/Names/SyntaxUtils.hs b/src/haskell-names/Language/Haskell/Names/SyntaxUtils.hs
index 6fbf956..7cd2d95 100644
--- a/src/haskell-names/Language/Haskell/Names/SyntaxUtils.hs
+++ b/src/haskell-names/Language/Haskell/Names/SyntaxUtils.hs
@@ -82,6 +82,7 @@ specialConToString (TupleCon _ Boxed n) = replicate (n-1) ','
specialConToString (TupleCon _ Unboxed n) = '#':replicate (n-1) ','
specialConToString (Cons _) = ":"
specialConToString (UnboxedSingleCon _) = "#"
+specialConToString (ExprHole _) = "_"
unCName :: CName l -> Name l
unCName (VarName _ n) = n
diff --git a/src/haskell-names/Language/Haskell/Names/Types.hs b/src/haskell-names/Language/Haskell/Names/Types.hs
index eae7c58..78859e2 100644
--- a/src/haskell-names/Language/Haskell/Names/Types.hs
+++ b/src/haskell-names/Language/Haskell/Names/Types.hs
@@ -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 Data.Lens.Light
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 @@ instance HasOrigName SymTypeInfo where
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)
diff --git a/src/tests/Test/Compile.hs b/src/tests/Test/Compile.hs
index ee00291..06715cf 100644
--- a/src/tests/Test/Compile.hs
+++ b/src/tests/Test/Compile.hs
@@ -7,9 +7,6 @@ module Test.Compile (tests,runScriptFile) where
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