File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 1
1
{-# LANGUAGE CPP #-}
2
+ {-# LANGUAGE TemplateHaskellQuotes #-}
3
+ {-# LANGUAGE ViewPatterns #-}
2
4
3
5
#undef WINDOWS
4
6
#define POSIX
@@ -18,10 +20,11 @@ pstr =
18
20
ps <- either (fail . show ) pure $ encodeWith (mkUTF8 ErrorOnCodingFailure ) s
19
21
when (not $ isValid ps) $ fail (" filepath not valid: " ++ show ps)
20
22
lift ps
21
- , quotePat = \ _ ->
22
- fail " illegal QuasiQuote (allowed as expression only, used as a pattern)"
23
+ , quotePat = \ s -> do
24
+ osp' <- either (fail . show ) pure . encodeWith (mkUTF8 ErrorOnCodingFailure ) $ s
25
+ [p |((==) osp' -> True)|]
23
26
, quoteType = \ _ ->
24
- fail " illegal QuasiQuote (allowed as expression only, used as a type)"
27
+ fail " illegal QuasiQuote (allowed as expression or pattern only, used as a type)"
25
28
, quoteDec = \ _ ->
26
- fail " illegal QuasiQuote (allowed as expression only, used as a declaration)"
29
+ fail " illegal QuasiQuote (allowed as expression or pattern only, used as a declaration)"
27
30
}
Original file line number Diff line number Diff line change 1
1
{-# LANGUAGE CPP #-}
2
+ {-# LANGUAGE TemplateHaskellQuotes #-}
3
+ {-# LANGUAGE ViewPatterns #-}
2
4
3
5
#undef POSIX
4
6
#define IS_WINDOWS True
@@ -19,10 +21,11 @@ pstr =
19
21
ps <- either (fail . show ) pure $ encodeWith (mkUTF16le ErrorOnCodingFailure ) s
20
22
when (not $ isValid ps) $ fail (" filepath not valid: " ++ show ps)
21
23
lift ps
22
- , quotePat = \ _ ->
23
- fail " illegal QuasiQuote (allowed as expression only, used as a pattern)"
24
+ , quotePat = \ s -> do
25
+ osp' <- either (fail . show ) pure . encodeWith (mkUTF16le ErrorOnCodingFailure ) $ s
26
+ [p |((==) osp' -> True)|]
24
27
, quoteType = \ _ ->
25
- fail " illegal QuasiQuote (allowed as expression only, used as a type)"
28
+ fail " illegal QuasiQuote (allowed as expression or pattern only, used as a type)"
26
29
, quoteDec = \ _ ->
27
- fail " illegal QuasiQuote (allowed as expression only, used as a declaration)"
30
+ fail " illegal QuasiQuote (allowed as expression or pattern only, used as a declaration)"
28
31
}
You can’t perform that action at this time.
0 commit comments