Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
require
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AspectAG
require
Commits
341a7b5a
Commit
341a7b5a
authored
Jul 1, 2022
by
Juan Pablo Garcia Garland
Browse files
Options
Downloads
Patches
Plain Diff
small cleanup+hide test modules
parent
3028ac80
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
requirements.cabal
+1
-1
1 addition, 1 deletion
requirements.cabal
src/Data/Type/Require.hs
+6
-9
6 additions, 9 deletions
src/Data/Type/Require.hs
src/Figures.lhs
+20
-6
20 additions, 6 deletions
src/Figures.lhs
with
27 additions
and
16 deletions
requirements.cabal
+
1
−
1
View file @
341a7b5a
...
...
@@ -21,7 +21,7 @@ cabal-version: >=1.10
library
exposed-modules: Data.Type.Require
other-modules: Figures, Vector
--
other-modules: Figures, Vector
other-extensions: UndecidableInstances
, MultiParamTypeClasses
, FlexibleContexts
...
...
This diff is collapsed.
Click to expand it.
src/Data/Type/Require.hs
+
6
−
9
View file @
341a7b5a
...
...
@@ -163,8 +163,7 @@ instance (TypeError
type
family
IsEmptyCtx
(
ms
::
[
ErrorMessage
])
::
Bool
where
IsEmptyCtx
'
[]
=
True
IsEmptyCtx
(
m
'
:
ms
)
=
False
-- IsEmptyMsg m && IsEmptyCtx ms
IsEmptyCtx
_
=
True
IsEmptyCtx
(
m
'
:
ms
)
=
False
type
family
IsEmptyMsg
(
m
::
ErrorMessage
)
::
Bool
where
IsEmptyMsg
(
Text
""
)
=
True
...
...
@@ -173,8 +172,8 @@ type family IsEmptyMsg (m :: ErrorMessage) :: Bool where
-- -- | Formatting of context printing.
type
family
ShowCTX
(
ctx
::
[
ErrorMessage
])
::
ErrorMessage
where
ShowCTX
(
'
[]
)
=
'Text
""
ShowCTX
((
m
::
ErrorMessage
)
'
:
(
ms
::
[
ErrorMessage
]))
=
m
:$$:
ShowCTX
ms
ShowCTX
(
(
m
::
ErrorMessage
)
'
:
(
ms
::
[
ErrorMessage
]))
=
m
:$$:
ShowCTX
ms
ShowCTX
(
m
::
[
ErrorMessage
])
=
Text
""
...
...
@@ -234,12 +233,11 @@ type family RequireEqWithMsg (t :: k) (t' :: k) (msg :: k -> k -> Type)
(
ctx
::
[
ErrorMessage
])
::
Constraint
type
instance
RequireEqWithMsg
t
t'
f
ctx
=
(
AssertEq'
t
t'
f
ctx
,
t
~
t'
)
--If (t `Equal` t') (()::Constraint) (Require (OpError (Eval (f t t'))) ctx)
)
type
family
AssertEq'
(
t1
::
k
)(
t2
::
k
)
(
f
::
k
->
k
->
Type
)
ctx
::
Constraint
type
family
AssertEq'
(
t1
::
k
)(
t2
::
k
)
(
f
::
k
->
k
->
Type
)
ctx
::
Constraint
where
AssertEq'
a
a
f
ctx
=
()
AssertEq'
a
b
f
ctx
=
Require
(
OpError
(
Eval
(
f
a
b
))
)
ctx
AssertEq'
a
b
f
ctx
=
Require
(
OpError
(
Eval
(
f
a
b
)))
ctx
-- Exported operators.
...
...
@@ -273,7 +271,6 @@ emptyCtx = Proxy :: Proxy '[ Text ""]
appendCtx
::
Proxy
ctx
->
Proxy
ctx'
->
Proxy
(
ctx
:++
ctx'
)
appendCtx
Proxy
Proxy
=
Proxy
type
family
(
:++
)
xs
ys
where
'
[]
:++
ys
=
ys
(
x
'
:
xs
)
:++
ys
=
x
'
:
(
xs
:++
ys
)
This diff is collapsed.
Click to expand it.
src/Figures.lhs
+
20
−
6
View file @
341a7b5a
...
...
@@ -118,7 +118,7 @@ combine' (Circle 1 1 1 :: Figure R2 (RGB 1 1 1))
>
f1
=
(
Circle
2
2
2
::
Figure
R2
(
RGB
1
1
1
))
>
f2
=
(
Sphere
2
2
2
2
::
Figure
R3
(
RGB
1
1
1
))
>
f
=
CFigure
$
\
Proxy
->
f1
>
f
=
(
CFigure
$
\
Proxy
->
f1
)
::
CFigure
'R2
(
'RGB
1
1
1
)
'
[]
>
f'
=
CFigure
$
\
Proxy
->
f2
>
f''
=
traceFig
...
...
@@ -132,13 +132,13 @@ combine' (Circle 1 1 1 :: Figure R2 (RGB 1 1 1))
>
combine''
>
::
(
Require
(
OpEqDim'
(
d
==
d'
)
d
d'
)
(
Text
"
lalo
"
:
ctx
),
>
Require
(
OpEqCol'
(
Equ
c
c'
)
c
c'
)
(
Text
"
lalo
"
:
ctx
))
=>
>
CFigure
d
c
ctx
->
CFigure
d'
c'
ctx
->
CFigure
d
c
ctx
>
::
(
Require
(
OpEqDim'
(
d
==
d'
)
d
d'
)
(
Text
"
combine''
"
:
ctx
),
>
Require
(
OpEqCol'
(
Equ
c
c'
)
c
c'
)
(
Text
"
combine''
"
:
ctx
))
=>
>
CFigure
d
c
ctx
->
CFigure
d'
c'
ctx
'
->
CFigure
d
c
ctx
>
combine''
(
CFigure
f1
)
(
CFigure
f2
)
>
=
CFigure
$
\
(
a
::
Proxy
ctx
)
->
>
req
(
Proxy
::
Proxy
(
Text
"
lalo
"
:
ctx
))
>
(
OpCombine
(
f1
a
)
(
f2
a
))
>
req
(
Proxy
::
Proxy
(
Text
"
combine''
"
:
ctx
))
>
(
OpCombine
(
f1
a
)
(
f2
Proxy
))
>
traceFig
::
(
Proxy
ctx'
->
Proxy
ctx
)
->
CFigure
d
c
ctx
->
CFigure
d
c
ctx'
...
...
@@ -149,3 +149,17 @@ combine' (Circle 1 1 1 :: Figure R2 (RGB 1 1 1))
Error:
> g = combine'' (tr $ tr f) (tr $ tr f'') -- (tr $ tr $ tr $ combine'' f f) f''
Adding traces:
>
addMsg
::
Proxy
msg
->
Proxy
(
msg
'
:
ctx
)
->
Proxy
ctx
>
addMsg
Proxy
Proxy
=
Proxy
>
f11
=
traceFig
(
addMsg
(
Proxy
@
(
Text
"11"
)))
f
>
f22
=
traceFig
(
addMsg
(
Proxy
@
(
Text
"22"
)))
f
>
fcomb
=
traceFig
(
addMsg
(
Proxy
@
(
Text
"comb"
)))
$
combine''
f11
f22
> ferr = traceFig (addMsg (Proxy @(Text "err"))) $ combine'' fcomb f'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment