File tree 9 files changed +152
-4
lines changed
9 files changed +152
-4
lines changed Original file line number Diff line number Diff line change 1
- .PHONY : install agda repl libHtml test testHtml golden docs
1
+ .PHONY : install agda repl libHtml test testContainers testHtml golden docs
2
2
FILES = $(shell find src -type f)
3
3
4
4
install :
@@ -17,7 +17,10 @@ libHtml :
17
17
test/agda2hs : $(FILES )
18
18
cabal install agda2hs --overwrite-policy=always --installdir=test --install-method=copy
19
19
20
- test : test/agda2hs
20
+ testContainers :
21
+ cd ./lib/containers && ./generate-haskell.sh && cabal build containers-prop
22
+
23
+ test : test/agda2hs testContainers
21
24
make -C test
22
25
23
26
testHtml : test/agda2hs
Original file line number Diff line number Diff line change 1
- packages : ./agda2hs.cabal
2
- constraints : Agda +debug
1
+ packages :
2
+ ./agda2hs.cabal
3
+ ./lib/containers/containers-prop.cabal
3
4
5
+ constraints : Agda +debug
Original file line number Diff line number Diff line change
1
+ # Revision history for containers-prop
2
+
3
+ ## 0.8.0.0 -- YYYY-mm-dd
4
+
5
+ * First version. Released on an unsuspecting world.
Original file line number Diff line number Diff line change
1
+ module Test.Agda2Hs.Data.Map where
2
+
3
+ open import Haskell.Prelude
4
+
5
+ open import Data.Map using (Map)
6
+ import Data.Map as Map
7
+
8
+ {-----------------------------------------------------------------------------
9
+ Test definitions
10
+ for exercising Data.Map
11
+ ------------------------------------------------------------------------------}
12
+ test0 : Map Nat String
13
+ test0 = Map.fromList ((1 , "Hello" ) ∷ (2 , "Map" ) ∷ [])
14
+
15
+ test1 : Map Nat String
16
+ test1 = Map.filter (λ x → length x > 3 ) test0
17
+
18
+ test2 : Map Nat String
19
+ test2 = Map.singleton 1 "Data"
20
+
21
+ test3 : Map Nat String
22
+ test3 = Map.unionWith _<>_ test0 (Map.unionWith _<>_ test1 test2)
23
+
24
+ test4 : Map Nat String
25
+ test4 = Map.intersectionWith _<>_ test2 test3
26
+
27
+ testLookup0 : Maybe String
28
+ testLookup0 = Map.lookup 1 test4
29
+
30
+ {-# COMPILE AGDA2HS test0 #-}
31
+ {-# COMPILE AGDA2HS test1 #-}
32
+ {-# COMPILE AGDA2HS test2 #-}
33
+ {-# COMPILE AGDA2HS test3 #-}
34
+ {-# COMPILE AGDA2HS test4 #-}
35
+ {-# COMPILE AGDA2HS testLookup0 #-}
Original file line number Diff line number Diff line change
1
+ module Test.Agda2Hs.Data.Set where
2
+
3
+ open import Haskell.Prelude
4
+
5
+ open import Data.Set using (Set )
6
+ import Data.Set as Set
7
+
8
+ {-----------------------------------------------------------------------------
9
+ Test definitions
10
+ for exercising Data.Set
11
+ ------------------------------------------------------------------------------}
12
+ test0 : Set String
13
+ test0 = Set.fromList ("Hello" ∷ "Set" ∷ [])
14
+
15
+ test1 : Set String
16
+ test1 = Set.filter (λ x → length x > 3 ) test0
17
+
18
+ test2 : Set String
19
+ test2 = Set.singleton "Data"
20
+
21
+ test3 : Set String
22
+ test3 = Set.union test0 (Set.union test1 test2)
23
+
24
+ test4 : Set String
25
+ test4 = Set.intersection test2 test3
26
+
27
+ testBool0 : Bool
28
+ testBool0 = Set.isSubsetOf test2 test4
29
+
30
+ {-# COMPILE AGDA2HS test0 #-}
31
+ {-# COMPILE AGDA2HS test1 #-}
32
+ {-# COMPILE AGDA2HS test2 #-}
33
+ {-# COMPILE AGDA2HS test3 #-}
34
+ {-# COMPILE AGDA2HS test4 #-}
35
+ {-# COMPILE AGDA2HS testBool0 #-}
Original file line number Diff line number Diff line change 2
2
3
3
import Data.Map
4
4
import Data.Set
5
+
6
+ import Test.Agda2Hs.Data.Map
7
+ import Test.Agda2Hs.Data.Set
Original file line number Diff line number Diff line change
1
+ ./../base/base.agda-lib
Original file line number Diff line number Diff line change
1
+ cabal-version : 3.0
2
+ name : containers-prop
3
+ build-type : Simple
4
+ version : 0.8
5
+ synopsis : Properties of containers, machine-checked
6
+ description :
7
+ This package collects properties about data structures from the
8
+ [containers](https://hackage.haskell.org/package/containers) package,
9
+ such as `Data.Set` and `Data.Map`.
10
+ .
11
+ Basic properties are postulated, hoping that the implementation
12
+ satisfies them.
13
+ However, more complicated properties are proven from the basic properties.
14
+ These proofs are formalized and machine-checked
15
+ using [agda2hs](https://hackage.haskell.org/package/agda2hs).
16
+
17
+ homepage : https://github.com/agda/agda2hs
18
+ license : BSD-3-Clause
19
+ author : Heinrich Apfelmus
20
+ maintainer : apfelmus@quantentunnel.de
21
+ copyright : 2025 Cardano Foundation
22
+ category : Language
23
+ extra-doc-files : CHANGELOG.md
24
+ extra-source-files :
25
+ agda/**/*.agda
26
+ containers.agda-lib
27
+ generate-haskell.sh
28
+
29
+ common language
30
+ default-language : Haskell2010
31
+
32
+ common opts-lib
33
+ ghc-options :
34
+ -Wall -Wcompat -Wincomplete-record-updates
35
+ -Wno-incomplete-uni-patterns -Wno-redundant-constraints
36
+ -Wno-unused-matches -Wno-unused-imports
37
+
38
+ library
39
+ import : language, opts-lib
40
+ hs-source-dirs : haskell
41
+ build-depends :
42
+ , base >= 4.13 && < 4.21
43
+ , containers >= 0.6 && < 0.9
44
+
45
+ exposed-modules :
46
+
47
+ -- Data.Maps.Maybe
48
+ -- Data.Map.Prop
49
+ -- Data.Map.Set
50
+ other-modules :
51
+ Test.Agda2Hs.Data.Map
52
+ Test.Agda2Hs.Data.Set
53
+ autogen-modules :
54
+ Test.Agda2Hs.Data.Map
55
+ Test.Agda2Hs.Data.Set
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ ROOT=containers.agda
3
+ AGDA2HS=" cabal run agda2hs --"
4
+ ${AGDA2HS} \
5
+ --local-interfaces \
6
+ --no-default-libraries \
7
+ --library-file ./agda2hs-libraries \
8
+ -o ./haskell/ \
9
+ ./agda/${ROOT}
You can’t perform that action at this time.
0 commit comments