haskell-src-exts-simple 1.18.0.0 → 1.18.0.1
raw patch · 5 files changed
+93/−16 lines, 5 filesdep ~basePVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Language.Haskell.Exts.Simple.Parser: listOf :: [a] -> ListOf a
+ Language.Haskell.Exts.Simple.Syntax: charL :: Char -> Literal
+ Language.Haskell.Exts.Simple.Syntax: fracL :: Rational -> Literal
+ Language.Haskell.Exts.Simple.Syntax: intL :: Integer -> Literal
+ Language.Haskell.Exts.Simple.Syntax: primCharL :: Char -> Literal
+ Language.Haskell.Exts.Simple.Syntax: primDoubleL :: Rational -> Literal
+ Language.Haskell.Exts.Simple.Syntax: primFloatL :: Rational -> Literal
+ Language.Haskell.Exts.Simple.Syntax: primIntL :: Integer -> Literal
+ Language.Haskell.Exts.Simple.Syntax: primStringL :: String -> Literal
+ Language.Haskell.Exts.Simple.Syntax: primWordL :: Integer -> Literal
+ Language.Haskell.Exts.Simple.Syntax: stringL :: String -> Literal
Files
- COMPATIBILITY.md +2/−1
- haskell-src-exts-simple.cabal +7/−3
- src/Language/Haskell/Exts/Simple/Fixity.hs +2/−1
- src/Language/Haskell/Exts/Simple/Parser.hs +17/−1
- src/Language/Haskell/Exts/Simple/Syntax.hs +65/−10
COMPATIBILITY.md view
@@ -16,4 +16,5 @@ ## ghc versions -* haskell-src-exts-simple requires ghc-7.10 or later, because it relies on bidirectional pattern synonyms+* haskell-src-exts-simple requires ghc-7.8 or later+* Note that with ghc-7.8, the constructors of the `Language.Haskell.Exts.Simple.Syntax.Literal` type are only available for pattern matchin, because construction relies on explicitly bidirectional pattern synonyms for literals. For ghc-7.8 compatibility, you should use the `*L` (`intL` etc.) functions for constructing `Literal` values.
haskell-src-exts-simple.cabal view
@@ -1,5 +1,5 @@ name: haskell-src-exts-simple-version: 1.18.0.0+version: 1.18.0.1 synopsis: A simplified view on the haskell-src-exts AST description: This package provides a shim for haskell-src-exts (HSE), exposing the@@ -13,10 +13,13 @@ . See "Language.Haskell.Exts.Simple" for further information. .- __Versioning notice__: To be able to track the haskell-src-exts version+ __Versioning policy__: To be able to track the haskell-src-exts version numbers conveniently, the first __three__ components of the version will be treated as the major version, followed by the minor version as usual.+ .+ __GHC compatibility__: With ghc-7.8, some constructors only work as+ patterns. See "Language.Haskell.Exts.Simple.Syntax#t:Literal" license: MIT license-file: LICENSE author: Bertram Felgenhauer@@ -46,10 +49,11 @@ Language.Haskell.Exts.Simple.Syntax -- other-modules: other-extensions:+ CPP, PatternSynonyms, ScopedTypeVariables build-depends:- base >= 4.8 && < 5,+ base >= 4.7 && < 5, haskell-src-exts >= 1.18 && < 1.19 hs-source-dirs: src default-language: Haskell2010
src/Language/Haskell/Exts/Simple/Fixity.hs view
@@ -15,8 +15,9 @@ ) import Language.Haskell.Exts.Simple.Syntax import Language.Haskell.Exts.SrcLoc+import Control.Monad -- * Functions applyFixities :: (AppFixity ast, Functor ast, Monad m) => [Fixity] -> ast () -> m (ast ())-applyFixities fixs = fmap (fmap (const ())) . H.applyFixities fixs . fmap (const noSrcSpan)+applyFixities fixs = liftM (fmap (const ())) . H.applyFixities fixs . fmap (const noSrcSpan)
src/Language/Haskell/Exts/Simple/Parser.hs view
@@ -1,7 +1,11 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ScopedTypeVariables #-} -- | -- This module reexports "Language.Haskell.Exts.Parser" with adaptations.+--+-- __IMPORTANT__: if you require compatiblity with ghc 7.8, you should use the+-- function `listOf` for constructing `ListOf` values! module Language.Haskell.Exts.Simple.Parser ( module Language.Haskell.Exts.Simple.Parser,@@ -25,8 +29,20 @@ -- * Datatypes and Constructors -- ** `H.ListOf`+-- | Beware that the `ListOf` constructor only works in a pattern context+-- in ghc-7.8, because that version does not support explicitly bidirectional+-- pattern synonyms.+--+-- For code that needs to work with ghc-7.8, we provide the `listOf` function+-- constructing `ListOf` values.+ type ListOf = H.ListOf-pattern ListOf a <- H.ListOf _ a where ListOf a = H.ListOf H.noSrcSpan a+pattern ListOf a <- H.ListOf _ a+#if __GLASGOW_HASKELL__ > 708+ where ListOf a = listOf a+#endif+listOf :: [a] -> ListOf a+listOf a = H.ListOf H.noSrcSpan a -- ** `H.PragmasAndModuleName` type PragmasAndModuleName = H.PragmasAndModuleName ()
src/Language/Haskell/Exts/Simple/Syntax.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ScopedTypeVariables #-} -- |@@ -11,6 +12,18 @@ -- > type Name = H.Name () -- > pattern Ident a = H.Ident () a -- > pattern Symbol a = H.Symbol () a+--+-- This works nicely for all datatypes with two exception:+--+-- * `ImportDecl` has a record constructor, which is currently not supported+-- (support exists in ghc-8.0 but is not used by this module yet)+-- * `Literal` has constructors with an extra `String` argument that is not+-- used by `Language.Haskell.Exts.Simple.Pretty`. This module uses explicitly+-- bidirectional pattern synonyms to support this type, but support for that+-- is only available in ghc-7.10 and later.+--+-- __IMPORTANT__: if you require compatiblity with ghc 7.8, you should use the+-- functions `charL`, `stringL` etc. for constructing `Literal` values! module Language.Haskell.Exts.Simple.Syntax ( module Language.Haskell.Exts.Simple.Syntax,@@ -375,29 +388,71 @@ pattern WildCardA a = H.WildCardA () (a :: (Maybe Name)) :: Asst -- ** `H.Literal`--- literals are extra redundant!++-- | Beware that the constructors only work in a pattern context in ghc-7.8,+-- because that version does not support explicitly bidirectional pattern+-- synonyms.+--+-- For code that needs to work with ghc-7.8, we provide functions `charL`,+-- `stringL`, `intL`, `fracL`, etc. for constructing `Literal` values.+ type Literal = H.Literal () +#if __GLASGOW_HASKELL__ <= 708+#define where --+#endif+ pattern Char a <- H.Char () (a :: Char) _ :: Literal where Char a = H.Char () a [a]+charL :: Char -> Literal+charL a = H.Char () a [a]+ pattern String a <- H.String () (a :: String) _ :: Literal- where String a = H.String () a a+ where String a = stringL a+stringL :: String -> Literal+stringL a = H.String () a a+ pattern Int a <- H.Int () (a :: Integer) _ :: Literal- where Int a = H.Int () a (show a)+ where Int a = intL a+intL :: Integer -> Literal+intL a = H.Int () a (show a)+ pattern Frac a <- H.Frac () (a :: Rational) _ :: Literal- where Frac a = H.Frac () a (show a)+ where Frac a = fracL a+fracL :: Rational -> Literal+fracL a = H.Frac () a (show a)+ pattern PrimInt a <- H.PrimInt () (a :: Integer) _ :: Literal- where PrimInt a = H.PrimInt () a (show a)+ where PrimInt a = primIntL a+primIntL :: Integer -> Literal+primIntL a = H.PrimInt () a (show a)+ pattern PrimWord a <- H.PrimWord () (a :: Integer) _ :: Literal- where PrimWord a = H.PrimWord () a (show a)+ where PrimWord a = primWordL a+primWordL :: Integer -> Literal+primWordL a = H.PrimWord () a (show a)+ pattern PrimFloat a <- H.PrimFloat () (a :: Rational) _ :: Literal- where PrimFloat a = H.PrimFloat () a (show a)+ where PrimFloat a = primFloatL a+primFloatL :: Rational -> Literal+primFloatL a = H.PrimFloat () a (show (fromRational a :: Float))+ pattern PrimDouble a <- H.PrimDouble () (a :: Rational) _ :: Literal- where PrimDouble a = H.PrimDouble () a (show a)+ where PrimDouble a = primDoubleL a+primDoubleL :: Rational -> Literal+primDoubleL a = H.PrimDouble () a (show (fromRational a :: Double))+ pattern PrimChar a <- H.PrimChar () (a :: Char) _ :: Literal- where PrimChar a = H.PrimChar () a (show a)+ where PrimChar a = primCharL a+primCharL :: Char -> Literal+primCharL a = H.PrimChar () a [a]+ pattern PrimString a <- H.PrimString () (a :: String) _ :: Literal- where PrimString a = H.PrimString () a (show a)+ where PrimString a = primStringL a+primStringL :: String -> Literal+primStringL a = H.PrimString () a a++#undef where -- ** `H.Sign` type Sign = H.Sign ()