File tree Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Original file line number Diff line number Diff line change 1
1
module Boilerplater where
2
2
3
+ import Data.List (stripPrefix )
3
4
import Test.Tasty.QuickCheck
4
5
5
6
import Language.Haskell.TH
@@ -8,20 +9,4 @@ import Language.Haskell.TH
8
9
testProperties :: [Name ] -> Q Exp
9
10
testProperties nms = fmap ListE $ sequence [[| testProperty $ (stringE prop_name) $ (varE nm) | ]
10
11
| nm <- nms
11
- , Just prop_name <- [stripPrefix_maybe " prop_" (nameBase nm)]]
12
-
13
- -- This nice clean solution doesn't quite work since I need to use lexically-scoped type
14
- -- variables, which aren't supported by Template Haskell. Argh!
15
- -- testProperties :: Q [Dec] -> Q Exp
16
- -- testProperties mdecs = do
17
- -- decs <- mdecs
18
- -- property_exprs <- sequence [[| testProperty "$prop_name" $(return $ VarE nm) |]
19
- -- | FunD nm _clauses <- decs
20
- -- , Just prop_name <- [stripPrefix_maybe "prop_" (nameBase nm)]]
21
- -- return $ LetE decs (ListE property_exprs)
22
-
23
- stripPrefix_maybe :: String -> String -> Maybe String
24
- stripPrefix_maybe prefix what
25
- | what_start == prefix = Just what_end
26
- | otherwise = Nothing
27
- where (what_start, what_end) = splitAt (length prefix) what
12
+ , Just prop_name <- [stripPrefix " prop_" (nameBase nm)]]
You can’t perform that action at this time.
0 commit comments