Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
clean-and-itasks
clean-platform
Commits
f3f6a6e7
Commit
f3f6a6e7
authored
Apr 16, 2020
by
Mart Lubbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove PCont and Error type synonyms in Text.Parsers.Simple
parent
3e3fb986
Pipeline
#41397
passed with stage
in 1 minute and 46 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
20 deletions
+14
-20
src/libraries/OS-Independent/Clean/Types/Parse.icl
src/libraries/OS-Independent/Clean/Types/Parse.icl
+1
-1
src/libraries/OS-Independent/Internet/IRC.dcl
src/libraries/OS-Independent/Internet/IRC.dcl
+1
-2
src/libraries/OS-Independent/Internet/IRC.icl
src/libraries/OS-Independent/Internet/IRC.icl
+3
-3
src/libraries/OS-Independent/Text/Parsers/Simple/Core.dcl
src/libraries/OS-Independent/Text/Parsers/Simple/Core.dcl
+5
-7
src/libraries/OS-Independent/Text/Parsers/Simple/Core.icl
src/libraries/OS-Independent/Text/Parsers/Simple/Core.icl
+4
-7
No files found.
src/libraries/OS-Independent/Clean/Types/Parse.icl
View file @
f3f6a6e7
...
...
@@ -18,7 +18,7 @@ from Text import class Text(concat), instance Text String
import
Data
.
Functor
import
Control
.
Applicative
import
Control
.
Monad
from
Text
.
Parsers
.
Simple
.
Core
import
::
Parser
,
::
Error
,
from
Text
.
Parsers
.
Simple
.
Core
import
::
Parser
,
instance
Functor
(
Parser
t
),
instance
pure
(
Parser
t
),
instance
<*>
(
Parser
t
),
instance
Alternative
(
Parser
t
),
instance
Monad
(
Parser
t
),
pToken
,
pSepBy
,
pSepBy1
,
pList
,
pSatisfy
,
pPeek
,
...
...
src/libraries/OS-Independent/Internet/IRC.dcl
View file @
f3f6a6e7
...
...
@@ -4,7 +4,6 @@ from StdOverloaded import class fromInt, class toInt, class toString, class from
from
Data
.
Either
import
::
Either
from
Data
.
Maybe
import
::
Maybe
from
Text
.
Parsers
.
Simple
.
Core
import
::
Error
::
IRCMessage
=
{
irc_prefix
::
Maybe
(
Either
IRCUser
String
)
...
...
@@ -22,7 +21,7 @@ from Text.Parsers.Simple.Core import :: Error
,
irc_host
::
Maybe
String
}
parseIRCMessage
::
String
->
Either
[
Error
]
IRCMessage
parseIRCMessage
::
String
->
Either
[
String
]
IRCMessage
instance
toString
IRCCommand
,
IRCReplies
,
IRCErrors
,
IRCMessage
,
IRCUser
,
IRCNumReply
instance
fromInt
IRCReplies
,
IRCErrors
...
...
src/libraries/OS-Independent/Internet/IRC.icl
View file @
f3f6a6e7
...
...
@@ -16,7 +16,7 @@ import Text.Parsers.Simple.Core
derive
gPrint
IRCErrors
,
IRCReplies
,
Maybe
,
Either
,
IRCUser
,
IRCNumReply
parseIRCMessage
::
String
->
Either
[
Error
]
IRCMessage
parseIRCMessage
::
String
->
Either
[
String
]
IRCMessage
parseIRCMessage
s
=
case
runParser
parsePrefix
(
fromString
s
)
of
// Prefix is parsed
([(
prefix
,
rest
):_],
_)
...
...
@@ -61,7 +61,7 @@ where
parseName
=
toString
<$>
pSome
(
pAlpha
<|>
pDigit
<|>
pOneOf
[
'-
'
,
'
/'
])
//Parse Cmd
parseCmd
::
[
Char
]
->
Either
Error
IRCCommand
parseCmd
::
[
Char
]
->
Either
String
IRCCommand
parseCmd
cs
=
fst
$
gIRCParse
{|*|}
$
argfun
$
split
" "
$
toString
cs
where
argfun
::
[
String
]
->
[
String
]
...
...
@@ -408,7 +408,7 @@ derive gIRCPrint IRCCommand, (,)
pOne
[]
=
(
Left
"Expected an argument"
,
[])
pOne
[
a
:
as
]
=
(
Right
a
,
as
)
generic
gIRCParse
a
::
[
String
]
->
(
Either
Error
a
,
[
String
])
generic
gIRCParse
a
::
[
String
]
->
(
Either
String
a
,
[
String
])
gIRCParse
{|
UNIT
|}
a
=
(
Right
UNIT
,
a
)
gIRCParse
{|
String
|}
as
=
pOne
as
gIRCParse
{|
Int
|}
as
=
appFst
(
fmap
toInt
)
$
pOne
as
...
...
src/libraries/OS-Independent/Text/Parsers/Simple/Core.dcl
View file @
f3f6a6e7
...
...
@@ -6,9 +6,7 @@ from Data.Either import :: Either
from
Data
.
Functor
import
class
Functor
from
StdOverloaded
import
class
==
::
Error
:==
String
::
PCont
t
a
:==
[
t
]
->
([(
a
,
[
t
])],
[
Error
])
::
Parser
t
a
=
Parser
(
PCont
t
a
)
::
Parser
t
a
=:
Parser
([
t
]
->
([(
a
,
[
t
])],
[
String
]))
// AMF instances
instance
Functor
(
Parser
t
)
...
...
@@ -21,18 +19,18 @@ instance Monad (Parser t)
instance
MonadPlus
(
Parser
t
)
// Functions to run the parser
parse
::
!(
Parser
t
a
)
[
t
]
->
Either
[
Error
]
a
runParser
::
!(
Parser
t
a
)
[
t
]
->
([(
a
,
[
t
])],
[
Error
])
parse
::
!(
Parser
t
a
)
[
t
]
->
Either
[
String
]
a
runParser
::
!(
Parser
t
a
)
[
t
]
->
([(
a
,
[
t
])],
[
String
])
// Core combinators
pFail
::
Parser
t
a
pYield
::
a
->
Parser
t
a
pSatisfy
::
(
t
->
Bool
)
->
Parser
t
t
pError
::
Error
->
Parser
t
a
pError
::
String
->
Parser
t
a
pPeek
::
Parser
t
[
t
]
// Convenience parsers
(@!)
infixr
4
::
(
Parser
t
a
)
Error
->
Parser
t
a
(@!)
infixr
4
::
(
Parser
t
a
)
String
->
Parser
t
a
(<<|>)
infixr
4
::
(
Parser
t
a
)
(
Parser
t
a
)
->
Parser
t
a
(<|>>)
infixr
4
::
(
Parser
t
a
)
(
Parser
t
a
)
->
Parser
t
a
...
...
src/libraries/OS-Independent/Text/Parsers/Simple/Core.icl
View file @
f3f6a6e7
...
...
@@ -9,9 +9,6 @@ import Data.Func
import
Data
.
Functor
import
Data
.
List
::
PCont
t
a
:==
[
t
]
->
([(
a
,
[
t
])],
[
Error
])
::
Parser
t
a
=
Parser
(
PCont
t
a
)
instance
Functor
(
Parser
t
)
where
fmap
f
p
=
pMap
f
p
...
...
@@ -37,7 +34,7 @@ instance MonadPlus (Parser t) where
mzero
=
pFail
mplus
l
r
=
l
<|>
r
parse
::
!(
Parser
t
a
)
[
t
]
->
Either
[
Error
]
a
parse
::
!(
Parser
t
a
)
[
t
]
->
Either
[
String
]
a
parse
p
ts
=
case
runParser
p
ts
of
(
rs
,
[])
->
case
[
r
\\
(
r
,
[])
<-
rs
]
of
...
...
@@ -45,16 +42,16 @@ parse p ts
_
->
Left
[
"No parse results with a fully consumed input."
]
(_,
es
)
->
Left
es
runParser
::
!(
Parser
t
a
)
[
t
]
->
([(
a
,
[
t
])],
[
Error
])
runParser
::
!(
Parser
t
a
)
[
t
]
->
([(
a
,
[
t
])],
[
String
])
runParser
(
Parser
f
)
xs
=
f
xs
pFail
::
Parser
t
a
pFail
=
Parser
(\_
->
([],
[]))
pError
::
Error
->
Parser
t
a
pError
::
String
->
Parser
t
a
pError
err
=
Parser
(\_
->
([],
[
err
]))
(@!)
infixr
4
::
(
Parser
t
a
)
Error
->
Parser
t
a
(@!)
infixr
4
::
(
Parser
t
a
)
String
->
Parser
t
a
(@!)
p
err
=
p
<<|>
pError
err
pYield
::
a
->
Parser
t
a
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment