Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
curry
curry-frontend
Commits
b17e8226
Commit
b17e8226
authored
Dec 12, 2017
by
Finn Teegen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change desugaring of numeric literals
parent
82e41a57
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
CHANGELOG.md
CHANGELOG.md
+2
-0
src/Transformations/Desugar.hs
src/Transformations/Desugar.hs
+6
-6
No files found.
CHANGELOG.md
View file @
b17e8226
...
...
@@ -4,6 +4,8 @@ Change log for curry-frontend
Under development (1.0.1)
=============
*
Changed desugaring of numeric literals. It now generates calls to the
functions
`Prelude.fromInt`
and
`Prelude.fromFloat`
.
*
Fixed bug with wrong original names of imported record labels
*
Fixed bug when compiling type constructor classes with super classes
...
...
src/Transformations/Desugar.hs
View file @
b17e8226
...
...
@@ -913,13 +913,13 @@ dsLiteral pty (Int i) = Right $ fixLiteral (unpredType pty)
fixLiteral
ty
|
ty
==
intType
=
Literal
pty
$
Int
i
|
ty
==
floatType
=
Literal
pty
$
Float
$
fromInteger
i
|
otherwise
=
Apply
(
prelFromInt
eger
$
unpredType
pty
)
$
|
otherwise
=
Apply
(
prelFromInt
$
unpredType
pty
)
$
Literal
predIntType
$
Int
i
dsLiteral
pty
f
@
(
Float
_
)
=
Right
$
fixLiteral
(
unpredType
pty
)
where
fixLiteral
(
TypeConstrained
tys
_
)
=
fixLiteral
(
head
tys
)
fixLiteral
ty
|
ty
==
floatType
=
Literal
pty
f
|
otherwise
=
Apply
(
prelFrom
Rational
$
unpredType
pty
)
$
|
otherwise
=
Apply
(
prelFrom
Float
$
unpredType
pty
)
$
Literal
predFloatType
f
dsLiteral
pty
(
String
cs
)
=
Left
$
List
pty
$
map
(
Literal
pty'
.
Char
)
cs
...
...
@@ -949,11 +949,11 @@ prelBind_ ma mb = preludeFun [ma, mb] mb ">>"
prelFlip
::
Type
->
Type
->
Type
->
Expression
PredType
prelFlip
a
b
c
=
preludeFun
[
TypeArrow
a
(
TypeArrow
b
c
),
b
,
a
]
c
"flip"
prelFromInt
eger
::
Type
->
Expression
PredType
prelFromInt
eger
a
=
preludeFun
[
intType
]
a
"fromInt
eger
"
prelFromInt
::
Type
->
Expression
PredType
prelFromInt
a
=
preludeFun
[
intType
]
a
"fromInt"
prelFrom
Rational
::
Type
->
Expression
PredType
prelFrom
Rational
a
=
preludeFun
[
floatType
]
a
"from
Rational
"
prelFrom
Float
::
Type
->
Expression
PredType
prelFrom
Float
a
=
preludeFun
[
floatType
]
a
"from
Float
"
prelEnumFrom
::
Type
->
Expression
PredType
prelEnumFrom
a
=
preludeFun
[
a
]
(
listType
a
)
"enumFrom"
...
...
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