haskell-src-meta 0.4 → 0.4.0.1
raw patch · 3 files changed
+100/−8 lines, 3 filesdep ~haskell-src-extsPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependency ranges changed: haskell-src-exts
API changes (from Hackage documentation)
+ Language.Haskell.Meta.Parse: instance DefaultFixities Fixity
+ Language.Haskell.Meta.Parse: instance DefaultFixities a => DefaultFixities (Maybe a)
+ Language.Haskell.Meta.Parse: instance DefaultFixities a => DefaultFixities [a]
Files
- README +45/−0
- haskell-src-meta.cabal +8/−3
- src/Language/Haskell/Meta/Parse.hs +47/−5
+ README view
@@ -0,0 +1,45 @@+haskell-src-meta is a package originally by Matt Morrow for converting a+parsed AST from haskell-src-exts to a TH AST for use in splices and+quasiquoters. The last version Matt released before he disappeared from+the Haskell community was 0.0.6, but by that time his library was+already popular, so some community members eventually decided to take+over maintenance of the package, keeping it up to date with the latest+versions of TH etc.++I don't really view this as "my" package so if you want write access to+the github repository, or you think you could do a better job as+maintainer, just ask.++Major changes:++0.3 -> 0.4:+- Remove Language.Haskell.Meta.Syntax.Vars and the L.H.M.Syntax re-export module+- Remove dependency on containers+- Add support for let statements in (pattern) guards+- Add support for negative patterns+- Remove "support" for SpliceExps that didn't really make sense+- Improve many error messages where things are unimplemented or impossible++0.2 -> 0.3:+- Fixes/additions to inline pragma support (Jonas Duregard)+- Compatibility with GHC 7 and TH 2.5 - totalling three major versions!+- Move some of the quasiquoters to their own package, and stop exporting+ the rest (they are kept as examples of usage)++0.1.1 -> 0.2:+- Compatibility with GHC 6.10 and TH 2.3 (Geoffrey Mainland)+- Add support for do-blocks, pattern guards (Adam Vogt)+- Add applicative-do quasiquoter (Adam Vogt)++0.1.0 -> 0.1.1:+- Add support for inline pragmas, and improve support for type+ signatures (patch by Jonas Duregard)++0.0.6 -> 0.1.0:+- Used the th-lift library to autogenerate the instances of Lift in+ Language.Haskell.TH.Instances.Lift+- Added support for the new features of template-haskell-2.4.0.0:+ contexts, kinds, bang patterns, unboxed word literals.+- Updated use of haskell-src-exts in response to API changes.+- Added ToDecs class because some HSE Decls don't map to a single Dec.+ (patch by Jonas Duregard)
haskell-src-meta.cabal view
@@ -1,5 +1,5 @@ name: haskell-src-meta-version: 0.4+version: 0.4.0.1 cabal-version: >= 1.6 build-type: Simple license: BSD3@@ -14,15 +14,20 @@ description: The translation from haskell-src-exts abstract syntax to template-haskell abstract syntax isn't 100% complete yet. -extra-source-files: examples/*.hs+extra-source-files: examples/*.hs README library build-depends: base >= 4.1 && < 4.4,- haskell-src-exts >= 1.6 && < 1.11,+ haskell-src-exts >= 1.6 && < 1.12, template-haskell >= 2.3 && < 2.6, pretty == 1.0.*, syb >= 0.1 && < 0.4, th-lift == 0.5.*+ extensions: CPP,+ RankNTypes,+ StandaloneDeriving,+ TemplateHaskell,+ TypeSynonymInstances hs-source-dirs: src exposed-modules: Language.Haskell.Meta Language.Haskell.Meta.Parse
src/Language/Haskell/Meta/Parse.hs view
@@ -1,4 +1,3 @@- {- | Module : Language.Haskell.Meta.Parse Copyright : (c) Matt Morrow 2008@@ -8,14 +7,31 @@ Portability : portable (template-haskell) -} -module Language.Haskell.Meta.Parse where+module Language.Haskell.Meta.Parse (+ parsePat,+ parseExp,+ parseType,+ parseDecs,+ myDefaultParseMode,+ myDefaultExtensions,+ parseResultToEither,+ parseHsModule,+ parseHsDecls,+ parseHsType,+ parseHsExp,+ parseHsPat,+ pprHsModule,+ moduleDecls,+ emptySrcLoc,+ emptyHsModule+ ) where import Language.Haskell.TH.Syntax import Language.Haskell.Meta.Syntax.Translate import qualified Language.Haskell.Exts.Syntax as Hs-import Language.Haskell.Exts.Annotated.Fixity+import Language.Haskell.Exts.Annotated.Fixity as Fix import Language.Haskell.Exts.Extension-import Language.Haskell.Exts.Parser+import Language.Haskell.Exts.Parser hiding (parseExp, parseType, parsePat) import Language.Haskell.Exts.Pretty -----------------------------------------------------------------------------@@ -36,13 +52,39 @@ ----------------------------------------------------------------------------- +{-# DEPRECATED myDefaultParseMode, myDefaultExtensions+ "The provided ParseModes aren't very meaningful, use your own instead" #-} myDefaultParseMode :: ParseMode myDefaultParseMode = ParseMode {parseFilename = [] ,extensions = myDefaultExtensions ,ignoreLinePragmas = False ,ignoreLanguagePragmas = False- ,fixities = baseFixities}+ ,fixities = defaultFixities}++-- This is a silly hack to make things work on haskell-src-exts versions+-- 1.10 and 1.11 simultaneously. I justify it because myDefaultParseMode is+-- deprecated anyway.+--+-- Essentially we want defaultFixities to be baseFixities or Just baseFixities+-- as appropriate. We do this without requiring FlexibleInstances using the+-- same trick as Show on lists does.+class DefaultFixities a where+ defaultFixities :: a+ defaultFixities =+ error "Language.Haskell.Meta.Parse.defaultFixities undefined"+ defaultFixityList :: [a]+ defaultFixityList =+ error "Language.Haskell.Meta.Parse.defaultFixityList undefined"++instance DefaultFixities Fix.Fixity where+ defaultFixityList = baseFixities++instance DefaultFixities a => DefaultFixities [a] where+ defaultFixities = defaultFixityList++instance DefaultFixities a => DefaultFixities (Maybe a) where+ defaultFixities = Just defaultFixities myDefaultExtensions :: [Extension] myDefaultExtensions = [PostfixOperators