Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
filepath
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Haskell
filepath
Commits
1c7f639e
Unverified
Commit
1c7f639e
authored
1 year ago
by
Julian Ospald
Browse files
Options
Downloads
Patches
Plain Diff
Allow pstr quasiquoter as pattern too
parent
2031d91c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
System/OsPath/Posix.hs
+7
-4
7 additions, 4 deletions
System/OsPath/Posix.hs
System/OsPath/Windows.hs
+7
-4
7 additions, 4 deletions
System/OsPath/Windows.hs
with
14 additions
and
8 deletions
System/OsPath/Posix.hs
+
7
−
4
View file @
1c7f639e
{-# LANGUAGE CPP #-}
{-# LANGUAGE TemplateHaskellQuotes #-}
{-# LANGUAGE ViewPatterns #-}
#
undef
WINDOWS
#
define
POSIX
...
...
@@ -18,10 +20,11 @@ pstr =
ps
<-
either
(
fail
.
show
)
pure
$
encodeWith
(
mkUTF8
ErrorOnCodingFailure
)
s
when
(
not
$
isValid
ps
)
$
fail
(
"filepath not valid: "
++
show
ps
)
lift
ps
,
quotePat
=
\
_
->
fail
"illegal QuasiQuote (allowed as expression only, used as a pattern)"
,
quotePat
=
\
s
->
do
osp'
<-
either
(
fail
.
show
)
pure
.
encodeWith
(
mkUTF8
ErrorOnCodingFailure
)
$
s
[
p
|
((==) osp' -> True)
|]
,
quoteType
=
\
_
->
fail
"illegal QuasiQuote (allowed as expression only, used as a type)"
fail
"illegal QuasiQuote (allowed as expression
or pattern
only, used as a type)"
,
quoteDec
=
\
_
->
fail
"illegal QuasiQuote (allowed as expression only, used as a declaration)"
fail
"illegal QuasiQuote (allowed as expression
or pattern
only, used as a declaration)"
}
This diff is collapsed.
Click to expand it.
System/OsPath/Windows.hs
+
7
−
4
View file @
1c7f639e
{-# LANGUAGE CPP #-}
{-# LANGUAGE TemplateHaskellQuotes #-}
{-# LANGUAGE ViewPatterns #-}
#
undef
POSIX
#
define
IS_WINDOWS
True
...
...
@@ -19,10 +21,11 @@ pstr =
ps
<-
either
(
fail
.
show
)
pure
$
encodeWith
(
mkUTF16le
ErrorOnCodingFailure
)
s
when
(
not
$
isValid
ps
)
$
fail
(
"filepath not valid: "
++
show
ps
)
lift
ps
,
quotePat
=
\
_
->
fail
"illegal QuasiQuote (allowed as expression only, used as a pattern)"
,
quotePat
=
\
s
->
do
osp'
<-
either
(
fail
.
show
)
pure
.
encodeWith
(
mkUTF16le
ErrorOnCodingFailure
)
$
s
[
p
|
((==) osp' -> True)
|]
,
quoteType
=
\
_
->
fail
"illegal QuasiQuote (allowed as expression only, used as a type)"
fail
"illegal QuasiQuote (allowed as expression
or pattern
only, used as a type)"
,
quoteDec
=
\
_
->
fail
"illegal QuasiQuote (allowed as expression only, used as a declaration)"
fail
"illegal QuasiQuote (allowed as expression
or pattern
only, used as a declaration)"
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment