stylish-haskell 0.5.7.0 → 0.5.8.0
raw patch · 3 files changed
+26/−10 lines, 3 filesdep ~haskell-src-extsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: haskell-src-exts
API changes (from Hackage documentation)
Files
- src/Language/Haskell/Stylish/Parse.hs +12/−6
- stylish-haskell.cabal +4/−4
- tests/Language/Haskell/Stylish/Parse/Tests.hs +10/−0
src/Language/Haskell/Stylish/Parse.hs view
@@ -40,18 +40,24 @@ parseModule :: Extensions -> Maybe FilePath -> String -> Either String Module parseModule extraExts mfp string = do -- Determine the extensions: those specified in the file and the extra ones- let noBom = dropBom string- extraExts' = map H.classifyExtension extraExts- fileExts = fromMaybe [] $ H.readExtensions noBom- exts = fileExts ++ extraExts'+ let noBom = dropBom string+ extraExts' = map H.classifyExtension extraExts+ (lang, fileExts) = fromMaybe (Nothing, []) $ H.readExtensions noBom+ exts = fileExts ++ extraExts' -- Parsing options... fp = fromMaybe "<unknown>" mfp mode = H.defaultParseMode- {H.extensions = exts, H.fixities = Nothing}+ { H.extensions = exts+ , H.fixities = Nothing+ , H.baseLanguage = case lang of+ Nothing -> H.baseLanguage H.defaultParseMode+ Just l -> l+ } -- Preprocessing- noCpp = if H.CPP `elem` exts then unCpp noBom else noBom+ noCpp =+ if H.EnableExtension H.CPP `elem` exts then unCpp noBom else noBom case H.parseModuleWithComments mode noCpp of H.ParseOk md -> return md
stylish-haskell.cabal view
@@ -1,5 +1,5 @@ Name: stylish-haskell-Version: 0.5.7.0+Version: 0.5.8.0 Synopsis: Haskell code prettifier Homepage: https://github.com/jaspervdj/stylish-haskell License: BSD3@@ -49,7 +49,7 @@ containers >= 0.3 && < 0.6, directory >= 1.1 && < 1.3, filepath >= 1.1 && < 1.4,- haskell-src-exts >= 1.13 && < 1.14,+ haskell-src-exts >= 1.14 && < 1.15, mtl >= 2.0 && < 2.2, syb >= 0.3 && < 0.5, yaml >= 0.7 && < 0.9@@ -70,7 +70,7 @@ containers >= 0.3 && < 0.6, directory >= 1.1 && < 1.3, filepath >= 1.1 && < 1.4,- haskell-src-exts >= 1.13 && < 1.14,+ haskell-src-exts >= 1.14 && < 1.15, mtl >= 2.0 && < 2.2, syb >= 0.3 && < 0.5, yaml >= 0.7 && < 0.9@@ -103,7 +103,7 @@ containers >= 0.3 && < 0.6, directory >= 1.1 && < 1.3, filepath >= 1.1 && < 1.4,- haskell-src-exts >= 1.13 && < 1.14,+ haskell-src-exts >= 1.14 && < 1.15, mtl >= 2.0 && < 2.2, syb >= 0.3 && < 0.5, yaml >= 0.7 && < 0.9
tests/Language/Haskell/Stylish/Parse/Tests.hs view
@@ -20,6 +20,7 @@ [ testCase "UTF-8 Byte Order Mark" testBom , testCase "Extra extensions" testExtraExtensions , testCase "Multiline CPP" testMultilineCpp+ , testCase "Haskell2010 extension" testHaskell2010 ] @@ -45,6 +46,15 @@ [ "{-# LANGUAGE CPP #-}" , "#define foo bar \\" , " qux"+ ]+++--------------------------------------------------------------------------------+testHaskell2010 :: Assertion+testHaskell2010 = assert $ isRight $ parseModule [] Nothing $ unlines+ [ "{-# LANGUAGE Haskell2010 #-}"+ , "module X where"+ , "foo x | Just y <- x = y" ]