Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
curry
kics
Commits
502ed454
Commit
502ed454
authored
Jan 07, 2008
by
bbr
Browse files
show instances now working
parent
f84e194c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/CurryToHaskell.hs
View file @
502ed454
...
...
@@ -815,9 +815,8 @@ showInstance opts t@(Type origName vis vars consdecls) =
showFunction
showQ
opts
t
@
(
Type
origName
vis
vars
consdecls
)
|
maybe
False
(
elem
Show
)
(
lookup
(
snd
$
typeName
t
)
(
extInsts
opts
))
=
showsPrec
[
C
.
Rule
[]
(
C
.
SimpleExpr
(
hasPresym
"showsPrec"
))
[]
]
|
otherwise
=
{-if isTuple (snd origName)
then showTuple
else-}
showsPrec
(
map
showsPrecRule
consdecls
++
[
showFreeVar
])
|
otherwise
=
showsPrec
(
map
showsPrecRule
consdecls
++
[
showFreeVar
,
showGenerator
])
where
showParenArg
(
_
,
'('
:
_
)
=
hasPresym
"True"
showParenArg
_
=
if
showQ
then
hasPresym
"True"
else
lt
(
C
.
Var
"d"
)
app_prec
...
...
@@ -881,6 +880,15 @@ showFunction showQ opts t@(Type origName vis vars consdecls)
(
cons_
(
char_
'_'
)
(
app
(
hasPresym
"show"
)
(
C
.
Var
"i"
)))))
[]
showGenerator
=
C
.
Rule
[
_x
,
C
.
PComb
(
newModName
,
name
++
"Or"
)
[
C
.
PVar
"r"
,
_x
]]
(
C
.
SimpleExpr
(
app
(
hasPresym
"showString"
)
(
cons_
(
char_
'_'
)
(
app
(
hasPresym
"show"
)
(
app
(
cusym
"deref"
)
(
C
.
Var
"r"
))))))
[]
readInstance
::
Config
.
Options
->
TypeDecl
->
C
.
InstanceDecl
readInstance
opts
(
Type
origName
@
(
modName
,
name
)
vis
vars
consdecls
)
=
C
.
Instance
(
map
(
\
v
->
C
.
TypeClass
(
has
"Read"
)
[
toTVar
v
])
vars
)
...
...
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