Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clean-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
clean-platform
Commits
6b970942
Verified
Commit
6b970942
authored
Apr 18, 2020
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for abstract newtypes to Clean.Types
parent
e8aabfa0
Pipeline
#41521
passed with stage
in 1 minute and 48 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
4 deletions
+10
-4
src/libraries/OS-Independent/Clean/Types.dcl
src/libraries/OS-Independent/Clean/Types.dcl
+1
-0
src/libraries/OS-Independent/Clean/Types.icl
src/libraries/OS-Independent/Clean/Types.icl
+6
-4
src/libraries/OS-Independent/Clean/Types/CoclTransform.icl
src/libraries/OS-Independent/Clean/Types/CoclTransform.icl
+2
-0
src/libraries/OS-Independent/Clean/Types/Util.icl
src/libraries/OS-Independent/Clean/Types/Util.icl
+1
-0
No files found.
src/libraries/OS-Independent/Clean/Types.dcl
View file @
6b970942
...
...
@@ -85,6 +85,7 @@ from StdMaybe import :: Maybe
//* A record with its internal identifier, existentially quantified variables and fields
|
TDRSynonym
!
Type
//* A type synonym
|
TDRAbstract
!(
Maybe
TypeDefRhs
)
//* An abstract type
|
TDRAbstractNewType
!
Constructor
//* An abstract newtype
|
TDRAbstractSynonym
!
Type
//* An abstract type synonym
/**
...
...
src/libraries/OS-Independent/Clean/Types.icl
View file @
6b970942
...
...
@@ -200,10 +200,11 @@ removeTypeContexts (Strict t) = Strict (removeTypeContexts t)
constructorsToFunctions
::
!
TypeDef
->
[(
String
,
Type
,
Maybe
Priority
)]
constructorsToFunctions
{
td_name
,
td_uniq
,
td_args
,
td_rhs
}
=
case
td_rhs
of
TDRCons
_
conses
->
map
consfun
conses
TDRMoreConses
conses
->
map
consfun
conses
TDRNewType
cons
->
[
consfun
cons
]
_
->
[]
TDRCons
_
conses
->
map
consfun
conses
TDRMoreConses
conses
->
map
consfun
conses
TDRNewType
cons
->
[
consfun
cons
]
TDRAbstractNewType
cons
->
[
consfun
cons
]
_
->
[]
where
consfun
::
!
Constructor
->
(
String
,
Type
,
Maybe
Priority
)
consfun
c
=
(
c
.
cons_name
,
Func
c
.
cons_args
ret
c
.
cons_context
,
c
.
cons_priority
)
...
...
@@ -256,4 +257,5 @@ typeRhsRestrictions (TDRMoreConses cs) = flatten [c \\ {cons_context=TypeContext
typeRhsRestrictions
(
TDRRecord
_
_
_)
=
[]
typeRhsRestrictions
(
TDRSynonym
_)
=
[]
typeRhsRestrictions
(
TDRAbstract
_)
=
[]
typeRhsRestrictions
(
TDRAbstractNewType
{
cons_context
=
TypeContext
c
})
=
c
typeRhsRestrictions
(
TDRAbstractSynonym
_)
=
[]
src/libraries/OS-Independent/Clean/Types/CoclTransform.icl
View file @
6b970942
...
...
@@ -91,6 +91,8 @@ where
=
'
Clean
.
Types
'.
TDRAbstract
Nothing
toTypeDefRhs
(
AbstractTypeSpec
_
atype
)
=
'
Clean
.
Types
'.
TDRAbstractSynonym
('
Clean
.
Types
'.
toType
atype
)
toTypeDefRhs
(
AbstractNewTypeCons
_
atype
)
=
'
Clean
.
Types
'.
TDRAbstractNewType
('
Clean
.
Types
'.
toType
atype
)
toTypeDefRhs
(
ExtensibleConses
pcs
)
=
'
Clean
.
Types
'.
TDRCons
True
(
map
'
Clean
.
Types
'.
toConstructor
pcs
)
toTypeDefRhs
(
MoreConses
id
pcs
)
...
...
src/libraries/OS-Independent/Clean/Types/Util.icl
View file @
6b970942
...
...
@@ -118,6 +118,7 @@ where
print
_
(
TDRSynonym
t
)
=
" :== "
--
t
print
_
(
TDRAbstract
Nothing
)
=
[]
print
_
(
TDRAbstract
(
Just
rhs
))
=
" /*"
--
rhs
--
" */"
print
_
(
TDRAbstractNewType
c
)
=
" (=: "
--
c
--
")"
print
_
(
TDRAbstractSynonym
t
)
=
" (:== "
--
t
--
")"
printADT
::
!
Bool
![
Constructor
]
->
String
...
...
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