Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Informatik 8
CoPaR
Commits
33e9f5c7
Commit
33e9f5c7
authored
Jul 06, 2018
by
Hans-Peter Deifel
Browse files
Remove old functor parser module
parent
7fb7884f
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ma.cabal
View file @
33e9f5c7
...
...
@@ -37,7 +37,6 @@ library
, Data.OpenUnion
, Text.Parser.Lexer
, Text.Parser.Types
, Text.Parser.Functor
, Parser
, Algorithm
, MA.FunctorExpression.Type
...
...
src/Data/RefinementInterface.hs
View file @
33e9f5c7
...
...
@@ -8,21 +8,11 @@
{-# LANGUAGE StandaloneDeriving #-}
module
Data.RefinementInterface
where
import
Data.Text
(
Text
)
import
Data.Yaml
as
Yaml
import
Data.Vector
as
Vector
import
Data.MorphismEncoding
data
ArgumentParser
h
=
NoArguments
h
|
ArgumentParser
(
Yaml
.
Value
->
Yaml
.
Parser
h
)
data
RefinableFunctor
=
forall
h
.
RefinementInterface
h
=>
RefinableFunctor
{
name
::
Text
,
parseArguments
::
ArgumentParser
(
h
()
)
}
class
(
Show
(
h
()
)
,
Show
(
Label
h
)
,
Show
(
H1
h
)
...
...
@@ -42,8 +32,3 @@ class ( Show (h ())
parse
::
h
()
->
Vector
Yaml
.
Value
->
Yaml
.
Parser
(
Encoding
(
Label
h
)
(
H1
h
))
init
::
H1
h
->
[
Label
h
]
->
Weight
h
update
::
[
Label
h
]
->
Weight
h
->
(
Weight
h
,
H3
h
,
Weight
h
)
data
SomeRefinementInterface
where
SomeRefinementInterface
::
RefinementInterface
h
=>
h
()
->
SomeRefinementInterface
deriving
instance
Show
SomeRefinementInterface
src/Text/Parser/Functor.hs
deleted
100644 → 0
View file @
7fb7884f
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE OverloadedStrings #-}
module
Text.Parser.Functor
(
FunctorParser
(
..
)
,
SomeFunctorParser
(
..
)
,
functorsParser
)
where
import
Text.Megaparsec
import
qualified
Text.Megaparsec.Expr
as
Expr
import
Text.Parser.Types
import
Text.Parser.Lexer
import
Data.RefinementInterface
data
FunctorParser
a
=
Prefix
(
Parser
a
)
|
Postfix
(
Parser
a
)
deriving
(
Functor
)
data
SomeFunctorParser
where
SomeFunctorParser
::
RefinementInterface
h
=>
FunctorParser
(
h
()
)
->
SomeFunctorParser
makeOpTable
::
[[
SomeFunctorParser
]]
->
[[
Expr
.
Operator
Parser
[
SomeRefinementInterface
]]]
makeOpTable
=
map
(
map
funcToOp
)
where
funcToOp
::
SomeFunctorParser
->
Expr
.
Operator
Parser
[
SomeRefinementInterface
]
funcToOp
(
SomeFunctorParser
funcParser
)
=
case
funcParser
of
Prefix
p
->
Expr
.
Prefix
((
:
)
.
SomeRefinementInterface
<$>
p
)
Postfix
p
->
Expr
.
Postfix
((
:
)
.
SomeRefinementInterface
<$>
p
)
functorsParser
::
[[
SomeFunctorParser
]]
->
Parser
[
SomeRefinementInterface
]
functorsParser
functors
=
try
spaceConsumer
*>
Expr
.
makeExprParser
term
(
makeOpTable
functors
)
where
term
=
parens
(
functorsParser
functors
)
<|>
(
symbol
"X"
>>
return
[]
)
Write
Preview
Supports
Markdown
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