raw-feldspar 0.2.1 → 0.3
raw patch · 9 files changed
+56/−22 lines, 9 filesdep ~imperative-edsldep ~language-c-quotedep ~syntactic
Dependency ranges changed: imperative-edsl, language-c-quote, syntactic
Files
- raw-feldspar.cabal +30/−6
- src/Data/Selection.hs +8/−0
- src/Feldspar/Data/Option.hs +1/−0
- src/Feldspar/Primitive/Backend/C.hs +0/−3
- src/Feldspar/Representation.hs +1/−0
- src/Feldspar/Run/Compile.hs +8/−9
- src/Feldspar/Run/Representation.hs +2/−0
- tests/Compilation.hs +2/−2
- tests/Examples.hs +4/−2
raw-feldspar.cabal view
@@ -1,5 +1,5 @@ name: raw-feldspar-version: 0.2.1+version: 0.3 synopsis: Resource-Aware Feldspar description: An implementation of the Feldspar EDSL with focus on resource-awareness.@@ -17,7 +17,7 @@ license: BSD3 license-file: LICENSE author: Emil Axelsson-maintainer: emax@chalmers.se+maintainer: 78emil@gmail.com copyright: Copyright (c) 2016 Anders Persson, Anton Ekblad, Emil Axelsson, Josef Svenningsson, Koen Claessen, Markus Aronsson, Máté Karácsony@@ -98,16 +98,21 @@ containers, data-default-class, data-hash,- imperative-edsl >= 0.7,- -- hardware-edsl >= 0.1.0.2,+ imperative-edsl >= 0.8 && < 0.9, language-c-quote, mtl, operational-alacarte, prelude-edsl >= 0.4,- syntactic >= 3.6.1,- -- Smallest version that has `instD`+ syntactic >= 3.8,+ -- That version fixes overlap bugs template-haskell + if impl(ghc == 8.0.*)+ build-depends:+ language-c-quote < 0.12+ -- ,+ -- mainland-pretty >= 0.6+ hs-source-dirs: src ghc-options:@@ -144,6 +149,8 @@ mtl, raw-feldspar + ghc-options: -Wno-simplifiable-class-constraints+ test-suite Semantics type: exitcode-stdio-1.0 @@ -165,6 +172,8 @@ tasty-quickcheck, tasty-th + ghc-options: -Wno-simplifiable-class-constraints+ test-suite Examples type: exitcode-stdio-1.0 @@ -172,6 +181,19 @@ main-is: Examples.hs + other-modules:+ Concurrent+ DFT+ FFT+ Tut1_HelloWorld+ Tut2_ExpressionsAndTypes+ Tut3_Vectors+ Tut4_MemoryManagement+ Tut5_Matrices+ Tut6_Testing+ Tut7_ImperativeProgramming+ Tut8_SequentialVectors+ default-language: Haskell2010 build-depends:@@ -181,4 +203,6 @@ tasty, tasty-hunit, tasty-quickcheck++ ghc-options: -Wno-simplifiable-class-constraints
src/Data/Selection.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ -- | Data structure for describing selections of values module Data.Selection@@ -17,6 +19,12 @@ -- | Selection: description of a set of values data Selection a = Selection (a -> Bool)++#if MIN_VERSION_base(4,11,0)+instance Semigroup (Selection a)+ where+ (<>) = mappend+#endif -- | -- @
src/Feldspar/Data/Option.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE PolyKinds #-}+{-# LANGUAGE DataKinds #-} -- | Optional values
src/Feldspar/Primitive/Backend/C.hs view
@@ -362,8 +362,5 @@ f' <- compPrim $ Prim f return $ C.Cond c' t' f' mempty - go _ s _ = error $ "compPrim: no handling of symbol " ++ renderSym s- -- Should not occur, but the completeness checker doesn't know that- instance CompExp Prim where compExp = compPrim
src/Feldspar/Representation.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE PolyKinds #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE DataKinds #-} -- | Internal representation of Feldspar programs
src/Feldspar/Run/Compile.hs view
@@ -163,9 +163,6 @@ go t lit Nil | Just (Lit a) <- prj lit = return $ mapStruct (constExp . runIdentity) $ toStruct t a- go t lit Nil- | Just (Literal a) <- prj lit- = return $ mapStruct (constExp . runIdentity) $ toStruct t a go t var Nil | Just (VarT v) <- prj var = lookAlias t v@@ -180,11 +177,13 @@ | Just Pair <- prj tup = Two <$> goAST a <*> goAST b go t sel (ab :* Nil) | Just Fst <- prj sel = do- Two a _ <- goAST ab- return a+ ast <- goAST ab+ case ast of+ Two a _ -> return a | Just Snd <- prj sel = do- Two _ b <- goAST ab- return b+ ast <- goAST ab+ case ast of+ Two _ b -> return b go _ c Nil | Just Pi <- prj c = return $ Single $ sugarSymPrim Pi go _ op (a :* Nil)@@ -299,8 +298,8 @@ -- | Translate an expression that is assumed to fulfill @`PrimType` a@ unsafeTransSmallExp :: Monad m => Data a -> TargetT m (Prim a) unsafeTransSmallExp a = do- Single b <- translateExp a- return b+ exp <- translateExp a+ case exp of Single b -> return b -- This function should ideally have a `PrimType' a` constraint, but that is -- not allowed when passing it to `reexpressEnv`. It should be possible to -- make it work by changing the interface to `reexpressEnv`.
src/Feldspar/Run/Representation.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE DataKinds #-}+ -- | Monad for running Feldspar programs module Feldspar.Run.Representation where
tests/Compilation.hs view
@@ -76,9 +76,9 @@ tag "test_option" >> compareCompiled test_option (runIO test_option) "5\n" tag "test_option" >> compareCompiled test_option (runIO test_option) "6\n" tag "test_optionM" >> compareCompiled test_optionM (runIO test_option) "5\n"- tag "test_optionM" >> compareCompiled test_optionM (runIO test_optionM) "6\n"+ tag "test_optionM" >> compareCompiled test_optionM (runIO test_optionM) "5\n" tag "test_optionT" >> compareCompiled test_optionT (runIO test_optionT) "10\n" tag "test_constFoldArr" >> compareCompiled test_constFoldArr (runIO test_constFoldArr) "" where- tag str = putStrLn $ "---------------- examples/Demo.hs/" Prelude.++ str Prelude.++ "\n"+ tag str = putStrLn $ "---------------- tests/Compilation.hs/" Prelude.++ str Prelude.++ "\n"
tests/Examples.hs view
@@ -70,7 +70,10 @@ fs2 <- QC.run $ fb2 n QC.assert (fs1 Prelude.== fs2) -main =+main = (Concurrent.testAll >>) $+ -- It doesn't work to have `Concurrent.testAll` as a test case on+ -- GHC 8.4.2. But it works on GHC 8.0.2.+ marshalledM (return . dft) $ \dft' -> marshalledM (return . idft) $ \idft' -> marshalledM (fftS 1) $ \fft1 ->@@ -89,7 +92,6 @@ , testCase "Tut6" Tut6.testAll , testCase "Tut7" Tut7.testAll , testCase "Tut8" Tut8.testAll- , testCase "Concurrent" Concurrent.testAll , testProperty "fft1_dft" $ prop_fft_dft dft' fft1 , testProperty "fft2_dft" $ prop_fft_dft dft' fft2 , testProperty "dft_idft" $ prop_inverse dft' idft'