packages feed

fay 0.21.2 → 0.21.2.1

raw patch · 7 files changed

+52/−11 lines, 7 filesdep +randomdep ~containersPVP ok

version bump matches the API change (PVP)

Dependencies added: random

Dependency ranges changed: containers

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -2,6 +2,10 @@  See full history at: <https://github.com/faylang/fay/commits> +#### 0.21.2.1 (2014-11-10)++* Hide all packages by default when typechecking. This avoids conflicting with packages that haven't been specified on the command-line with `--package`, e.g. the `text` package when you import `Data.Text`.+ ### 0.21.2 (2014-10-21)  * Previously all package imports were ignored, now we only ignore `"base"` package imports.
fay.cabal view
@@ -1,5 +1,5 @@ name:                fay-version:             0.21.2+version:             0.21.2.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,@@ -169,11 +169,13 @@       , aeson       , attoparsec       , bytestring+      , containers       , directory       , fay       , filepath       , groom == 0.1.*       , haskell-src-exts+      , random >= 1.0 && < 1.2       , tasty >= 0.9 && < 0.11       , tasty-hunit >= 0.8 && < 0.10       , tasty-th == 0.1.*
src/Fay/Compiler/Typecheck.hs view
@@ -31,7 +31,7 @@         return [flag ++ '=' : pk]   let flags =           [ "-fno-code"-          , "-hide-package base"+          , "-hide-all-packages"           , "-cpp", "-pgmPcpphs", "-optP--cpp"           , "-optP-C" -- Don't let hse-cpp remove //-style comments.           , "-DFAY=1"
src/tests/Tests.hs view
@@ -15,9 +15,12 @@ import qualified Test.Desugar         as Desugar import           Test.Util +import           Data.Set             (Set)+import qualified Data.Set             as S import           System.Directory import           System.Environment import           System.FilePath+import           System.Random import           Test.Tasty import           Test.Tasty.HUnit @@ -25,10 +28,11 @@ main :: IO () main = do   sandbox <- fmap (lookup "HASKELL_PACKAGE_SANDBOX") getEnvironment-  (packageConf,args) <- fmap (prefixed (=="-package-conf")) getArgs-  let (basePath,args') = prefixed (=="-base-path") args-  (runtime,codegen) <- makeCompilerTests (packageConf <|> sandbox) basePath-  withArgs args' $ defaultMain $ testGroup "Fay"+  (packageConf,args)     <- prefixed (== "-package-conf") <$> getArgs+  let (basePath,args')    = prefixed (== "-base-path"   ) args+  let (testCount, args'') = first (readMay =<<) $ prefixed (== "-random") args'+  (runtime,codegen) <- makeCompilerTests (packageConf <|> sandbox) basePath testCount+  withArgs args'' $ defaultMain $ testGroup "Fay"     [ Desugar.tests     , Convert.tests     , codegen@@ -42,10 +46,11 @@ prefixed f (break f -> (x,y)) = (listToMaybe (drop 1 y),x ++ drop 2 y)  -- | Make the case-by-case unit tests.-makeCompilerTests :: Maybe FilePath -> Maybe FilePath -> IO (TestTree,TestTree)-makeCompilerTests packageConf basePath = do-  runtimeFiles <- runtimeTestFiles-  codegenFiles <- codegenTestFiles+makeCompilerTests :: Maybe FilePath -> Maybe FilePath -> Maybe Int -> IO (TestTree,TestTree)+makeCompilerTests packageConf basePath rand = do+  runtimeFiles' <- runtimeTestFiles+  runtimeFiles  <- maybe (return runtimeFiles') (randomize runtimeFiles') rand+  codegenFiles  <- codegenTestFiles   return     (makeTestGroup "Runtime tests"                    runtimeFiles@@ -67,6 +72,17 @@       getRecursiveContents "tests"     nonRuntime x =       any (`isInfixOf` x) ["/Compile/","/regressions/","/codegen/"]+    randomize :: [String] -> Int -> IO [String]+    randomize l i = do+      is <- randomizeAux S.empty i (0,length l - 1)+      return . map (l !!) $ S.toList is+    randomizeAux :: Set Int -> Int -> (Int,Int) -> IO (Set Int)+    randomizeAux s count b = do+      i <- randomRIO b+      let s' = S.insert i s+      if S.size s' == count+        then return s'+        else randomizeAux (S.insert i s) count b  testFile :: Maybe FilePath -> Maybe FilePath -> Bool -> String -> IO () testFile packageConf basePath opt file = do
tests/ExportQualified_Export.hs view
@@ -2,7 +2,7 @@ module ExportQualified_Export (main, X.X) where  import           Prelude-import           "foo" X+import           "base" X  main :: Fay () main = return ()
+ tests/TextOrd.hs view
@@ -0,0 +1,15 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports    #-}+{-# LANGUAGE RebindableSyntax #-}+module TextOrd where++import Prelude++import Data.Text++main :: Fay ()+main = do+  print ("abc" < ("c"::Text))+  print ("a" < ("bcd"::Text))+  print ("bcd" > ("a"::Text))+  print ("bcd" < ("a"::Text))
+ tests/TextOrd.res view
@@ -0,0 +1,4 @@+true+true+true+false