diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-10-10 12:01:14 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2016-10-08 00:20:34 -0700 |
commit | 00b530d5402aaa37e4085ecdcae0ae54454736c1 (patch) | |
tree | 2d2963db4abdbcba9c12aea13a26e29e718e4778 /testsuite/tests/backpack/should_run | |
parent | 887485a45ae55e81b26b6412b6f9dcf6a497f044 (diff) | |
download | haskell-00b530d5402aaa37e4085ecdcae0ae54454736c1.tar.gz |
The Backpack patch.
Summary:
This patch implements Backpack for GHC. It's a big patch but I've tried quite
hard to keep things, by-in-large, self-contained.
The user facing specification for Backpack can be found at:
https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst
A guide to the implementation can be found at:
https://github.com/ezyang/ghc-proposals/blob/backpack-impl/proposals/0000-backpack-impl.rst
Has a submodule update for Cabal, as well as a submodule update
for filepath to handle more strict checking of cabal-version.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, austin, simonmar, bgamari, goldfire
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D1482
Diffstat (limited to 'testsuite/tests/backpack/should_run')
19 files changed, 489 insertions, 0 deletions
diff --git a/testsuite/tests/backpack/should_run/Makefile b/testsuite/tests/backpack/should_run/Makefile new file mode 100644 index 0000000000..9101fbd40a --- /dev/null +++ b/testsuite/tests/backpack/should_run/Makefile @@ -0,0 +1,3 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk diff --git a/testsuite/tests/backpack/should_run/all.T b/testsuite/tests/backpack/should_run/all.T new file mode 100644 index 0000000000..b32560059b --- /dev/null +++ b/testsuite/tests/backpack/should_run/all.T @@ -0,0 +1,8 @@ +test('bkprun01', normal, backpack_run, ['']) +test('bkprun02', normal, backpack_run, ['']) +test('bkprun03', normal, backpack_run, ['']) +test('bkprun04', normal, backpack_run, ['']) +test('bkprun05', exit_code(1), backpack_run, ['']) +test('bkprun06', normal, backpack_run, ['']) +test('bkprun07', normal, backpack_run, ['']) +test('bkprun08', normal, backpack_run, ['']) diff --git a/testsuite/tests/backpack/should_run/bkprun01.bkp b/testsuite/tests/backpack/should_run/bkprun01.bkp new file mode 100644 index 0000000000..271990447f --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun01.bkp @@ -0,0 +1,13 @@ +unit p-impls where + module P(hello) where + hello = "Hello " + module Q(hello, world) where + import P + world = "World" + +unit main where + dependency p-impls + module Main where + import P + import Q + main = putStrLn (hello ++ world) diff --git a/testsuite/tests/backpack/should_run/bkprun01.stdout b/testsuite/tests/backpack/should_run/bkprun01.stdout new file mode 100644 index 0000000000..557db03de9 --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun01.stdout @@ -0,0 +1 @@ +Hello World diff --git a/testsuite/tests/backpack/should_run/bkprun02.bkp b/testsuite/tests/backpack/should_run/bkprun02.bkp new file mode 100644 index 0000000000..adb174c204 --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun02.bkp @@ -0,0 +1,23 @@ +unit p where + signature H where + data T + f :: T -> T + module A where + import H + data A = MkA T + ff :: A -> A + ff (MkA t) = MkA (f t) + +unit q where + module H where + data T = T Int + f (T i) = T (i+1) + +unit main where + dependency q + dependency p[H=q:H] + module Main where + import A + import H + main = case ff (MkA (T 0)) of + MkA (T i) -> print i diff --git a/testsuite/tests/backpack/should_run/bkprun02.stdout b/testsuite/tests/backpack/should_run/bkprun02.stdout new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun02.stdout @@ -0,0 +1 @@ +1 diff --git a/testsuite/tests/backpack/should_run/bkprun03.bkp b/testsuite/tests/backpack/should_run/bkprun03.bkp new file mode 100644 index 0000000000..162ab5af02 --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun03.bkp @@ -0,0 +1,25 @@ +unit p where + signature H where + x :: Bool + module PP where + y = False + module P where + import PP + import H + z :: Bool + z = x || y + +unit impls where + module H where + x = False + -- y = True + module H2 where + x = True + +unit main where + dependency impls + dependency p[H=impls:H] (P as P2, PP) + module Main where + import PP + import qualified P2 + main = print P2.z diff --git a/testsuite/tests/backpack/should_run/bkprun03.stdout b/testsuite/tests/backpack/should_run/bkprun03.stdout new file mode 100644 index 0000000000..bc59c12aa1 --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun03.stdout @@ -0,0 +1 @@ +False diff --git a/testsuite/tests/backpack/should_run/bkprun04.bkp b/testsuite/tests/backpack/should_run/bkprun04.bkp new file mode 100644 index 0000000000..c6b28999d4 --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun04.bkp @@ -0,0 +1,26 @@ +unit p where + signature H where + x :: Bool + module PP where + y = False + module P where + import PP + import H + z :: Bool + z = x || y + +unit impls where + module H where + x = False + y = True + module H2 where + x = True + +unit main where + dependency p[H=impls:H] (P, PP) + dependency p[H=impls:H2] (P as P2) + module Main where + import qualified P + import PP + import qualified P2 + main = print P.z >> print P2.z diff --git a/testsuite/tests/backpack/should_run/bkprun04.stdout b/testsuite/tests/backpack/should_run/bkprun04.stdout new file mode 100644 index 0000000000..91d6f80f27 --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun04.stdout @@ -0,0 +1,2 @@ +False +True diff --git a/testsuite/tests/backpack/should_run/bkprun05.bkp b/testsuite/tests/backpack/should_run/bkprun05.bkp new file mode 100644 index 0000000000..25c951e3ff --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun05.bkp @@ -0,0 +1,151 @@ +{-# LANGUAGE RoleAnnotations #-} +unit app where + signature Map where + import Data.Typeable + import Data.Data + import Data.Traversable + import Data.Foldable + import Data.Monoid + import Control.DeepSeq + import Control.Applicative + + infixl 9 !,\\ + + type role Map nominal representational + data Map k a + + instance Functor (Map k) + instance Foldable (Map k) + instance Traversable (Map k) + instance (Eq k, Eq a) => Eq (Map k a) + instance (Data k, Data a, Ord k) => Data (Map k a) + instance (Ord k, Ord v) => Ord (Map k v) + instance (Ord k, Read k, Read e) => Read (Map k e) + instance (Show k, Show a) => Show (Map k a) + instance Ord k => Monoid (Map k v) + instance (NFData k, NFData a) => NFData (Map k a) + + (!) :: Ord k => Map k a -> k -> a + (\\) :: Ord k => Map k a -> Map k b -> Map k a + null :: Map k a -> Bool + size :: Map k a -> Int + member :: Ord k => k -> Map k a -> Bool + notMember :: Ord k => k -> Map k a -> Bool + lookup :: Ord k => k -> Map k a -> Maybe a + findWithDefault :: Ord k => a -> k -> Map k a -> a + lookupLT :: Ord k => k -> Map k v -> Maybe (k, v) + lookupGT :: Ord k => k -> Map k v -> Maybe (k, v) + lookupLE :: Ord k => k -> Map k v -> Maybe (k, v) + lookupGE :: Ord k => k -> Map k v -> Maybe (k, v) + empty :: Map k a + singleton :: k -> a -> Map k a + insert :: Ord k => k -> a -> Map k a -> Map k a + insertWith :: Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a + insertWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> Map k a + insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a) + delete :: Ord k => k -> Map k a -> Map k a + adjust :: Ord k => (a -> a) -> k -> Map k a -> Map k a + adjustWithKey :: Ord k => (k -> a -> a) -> k -> Map k a -> Map k a + update :: Ord k => (a -> Maybe a) -> k -> Map k a -> Map k a + updateWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> Map k a + updateLookupWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> (Maybe a, Map k a) + alter :: Ord k => (Maybe a -> Maybe a) -> k -> Map k a -> Map k a + union :: Ord k => Map k a -> Map k a -> Map k a + unionWith :: Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a + unionWithKey :: Ord k => (k -> a -> a -> a) -> Map k a -> Map k a -> Map k a + unions :: Ord k => [Map k a] -> Map k a + unionsWith :: Ord k => (a -> a -> a) -> [Map k a] -> Map k a + difference :: Ord k => Map k a -> Map k b -> Map k a + differenceWith :: Ord k => (a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a + differenceWithKey :: Ord k => (k -> a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a + intersection :: Ord k => Map k a -> Map k b -> Map k a + intersectionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c + intersectionWithKey :: Ord k => (k -> a -> b -> c) -> Map k a -> Map k b -> Map k c + mergeWithKey :: Ord k => (k -> a -> b -> Maybe c) -> (Map k a -> Map k c) -> (Map k b -> Map k c) -> Map k a -> Map k b -> Map k c + map :: (a -> b) -> Map k a -> Map k b + mapWithKey :: (k -> a -> b) -> Map k a -> Map k b + traverseWithKey :: Applicative t => (k -> a -> t b) -> Map k a -> t (Map k b) + mapAccum :: (a -> b -> (a, c)) -> a -> Map k b -> (a, Map k c) + mapAccumWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c) + mapAccumRWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c) + mapKeys :: Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a + mapKeysWith :: Ord k2 => (a -> a -> a) -> (k1 -> k2) -> Map k1 a -> Map k2 a + mapKeysMonotonic :: (k1 -> k2) -> Map k1 a -> Map k2 a + foldr :: (a -> b -> b) -> b -> Map k a -> b + foldl :: (a -> b -> a) -> a -> Map k b -> a + foldrWithKey :: (k -> a -> b -> b) -> b -> Map k a -> b + foldlWithKey :: (a -> k -> b -> a) -> a -> Map k b -> a + foldMapWithKey :: Monoid m => (k -> a -> m) -> Map k a -> m + foldr' :: (a -> b -> b) -> b -> Map k a -> b + foldl' :: (a -> b -> a) -> a -> Map k b -> a + foldrWithKey' :: (k -> a -> b -> b) -> b -> Map k a -> b + foldlWithKey' :: (a -> k -> b -> a) -> a -> Map k b -> a + elems :: Map k a -> [a] + keys :: Map k a -> [k] + assocs :: Map k a -> [(k, a)] + toList :: Map k a -> [(k, a)] + fromList :: Ord k => [(k, a)] -> Map k a + fromListWith :: Ord k => (a -> a -> a) -> [(k, a)] -> Map k a + fromListWithKey :: Ord k => (k -> a -> a -> a) -> [(k, a)] -> Map k a + toAscList :: Map k a -> [(k, a)] + toDescList :: Map k a -> [(k, a)] + fromAscList :: Eq k => [(k, a)] -> Map k a + fromAscListWith :: Eq k => (a -> a -> a) -> [(k, a)] -> Map k a + fromAscListWithKey :: Eq k => (k -> a -> a -> a) -> [(k, a)] -> Map k a + fromDistinctAscList :: [(k, a)] -> Map k a + filter :: (a -> Bool) -> Map k a -> Map k a + filterWithKey :: (k -> a -> Bool) -> Map k a -> Map k a + partition :: (a -> Bool) -> Map k a -> (Map k a, Map k a) + partitionWithKey :: (k -> a -> Bool) -> Map k a -> (Map k a, Map k a) + mapMaybe :: (a -> Maybe b) -> Map k a -> Map k b + mapMaybeWithKey :: (k -> a -> Maybe b) -> Map k a -> Map k b + mapEither :: (a -> Either b c) -> Map k a -> (Map k b, Map k c) + mapEitherWithKey :: (k -> a -> Either b c) -> Map k a -> (Map k b, Map k c) + split :: Ord k => k -> Map k a -> (Map k a, Map k a) + splitLookup :: Ord k => k -> Map k a -> (Map k a, Maybe a, Map k a) + splitRoot :: Map k b -> [Map k b] + isSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool + isSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool + isProperSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool + isProperSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool + lookupIndex :: Ord k => k -> Map k a -> Maybe Int + findIndex :: Ord k => k -> Map k a -> Int + elemAt :: Int -> Map k a -> (k, a) + updateAt :: (k -> a -> Maybe a) -> Int -> Map k a -> Map k a + deleteAt :: Int -> Map k a -> Map k a + findMin :: Map k a -> (k, a) + findMax :: Map k a -> (k, a) + deleteMin :: Map k a -> Map k a + deleteMax :: Map k a -> Map k a + deleteFindMin :: Map k a -> ((k, a), Map k a) + deleteFindMax :: Map k a -> ((k, a), Map k a) + updateMin :: (a -> Maybe a) -> Map k a -> Map k a + updateMax :: (a -> Maybe a) -> Map k a -> Map k a + updateMinWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a + updateMaxWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a + minView :: Map k a -> Maybe (a, Map k a) + maxView :: Map k a -> Maybe (a, Map k a) + minViewWithKey :: Map k a -> Maybe ((k, a), Map k a) + maxViewWithKey :: Map k a -> Maybe ((k, a), Map k a) + showTree :: (Show k, Show a) => Map k a -> String + showTreeWith :: (k -> a -> String) -> Bool -> Bool -> Map k a -> String + valid :: Ord k => Map k a -> Bool + module App where + import Map + app = do + let x = insert 0 "foo" + . delete 1 + . insert 1 undefined + . insert (6 :: Int) "foo" + $ empty + print (member 1 x) + print (toList x) + print x + +unit main where + dependency app[Map=containers:Data.Map.Strict] (App as Strict) + dependency app[Map=containers:Data.Map.Lazy] (App as Lazy) + module Main where + import qualified Strict + import qualified Lazy + main = Lazy.app >> Strict.app diff --git a/testsuite/tests/backpack/should_run/bkprun05.stderr b/testsuite/tests/backpack/should_run/bkprun05.stderr new file mode 100644 index 0000000000..d9042b073d --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun05.stderr @@ -0,0 +1,4 @@ +bkprun05: Prelude.undefined +CallStack (from HasCallStack): + error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err + undefined, called at bkprun05.bkp:138:30 in app+app-9GMmly0OuEYHDXryaGD7sX:App diff --git a/testsuite/tests/backpack/should_run/bkprun05.stdout b/testsuite/tests/backpack/should_run/bkprun05.stdout new file mode 100644 index 0000000000..687b80c41d --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun05.stdout @@ -0,0 +1,3 @@ +False +[(0,"foo"),(6,"foo")] +fromList [(0,"foo"),(6,"foo")] diff --git a/testsuite/tests/backpack/should_run/bkprun06.bkp b/testsuite/tests/backpack/should_run/bkprun06.bkp new file mode 100644 index 0000000000..596fa897bc --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun06.bkp @@ -0,0 +1,164 @@ +{-# LANGUAGE RoleAnnotations #-} +unit sigs where + signature Map where + import Data.Typeable + import Data.Data + import Data.Traversable + import Data.Foldable + import Data.Monoid + import Control.DeepSeq + import Control.Applicative + + infixl 9 !,\\ + + type role Map nominal representational + data Map k a + + instance Functor (Map k) + instance Foldable (Map k) + instance Traversable (Map k) + instance (Eq k, Eq a) => Eq (Map k a) + instance (Data k, Data a, Ord k) => Data (Map k a) + instance (Ord k, Ord v) => Ord (Map k v) + instance (Ord k, Read k, Read e) => Read (Map k e) + instance (Show k, Show a) => Show (Map k a) + instance Ord k => Monoid (Map k v) + instance (NFData k, NFData a) => NFData (Map k a) + + (!) :: Ord k => Map k a -> k -> a + (\\) :: Ord k => Map k a -> Map k b -> Map k a + null :: Map k a -> Bool + size :: Map k a -> Int + member :: Ord k => k -> Map k a -> Bool + notMember :: Ord k => k -> Map k a -> Bool + lookup :: Ord k => k -> Map k a -> Maybe a + findWithDefault :: Ord k => a -> k -> Map k a -> a + lookupLT :: Ord k => k -> Map k v -> Maybe (k, v) + lookupGT :: Ord k => k -> Map k v -> Maybe (k, v) + lookupLE :: Ord k => k -> Map k v -> Maybe (k, v) + lookupGE :: Ord k => k -> Map k v -> Maybe (k, v) + empty :: Map k a + singleton :: k -> a -> Map k a + insert :: Ord k => k -> a -> Map k a -> Map k a + insertWith :: Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a + insertWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> Map k a + insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a) + delete :: Ord k => k -> Map k a -> Map k a + adjust :: Ord k => (a -> a) -> k -> Map k a -> Map k a + adjustWithKey :: Ord k => (k -> a -> a) -> k -> Map k a -> Map k a + update :: Ord k => (a -> Maybe a) -> k -> Map k a -> Map k a + updateWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> Map k a + updateLookupWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> (Maybe a, Map k a) + alter :: Ord k => (Maybe a -> Maybe a) -> k -> Map k a -> Map k a + union :: Ord k => Map k a -> Map k a -> Map k a + unionWith :: Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a + unionWithKey :: Ord k => (k -> a -> a -> a) -> Map k a -> Map k a -> Map k a + unions :: Ord k => [Map k a] -> Map k a + unionsWith :: Ord k => (a -> a -> a) -> [Map k a] -> Map k a + difference :: Ord k => Map k a -> Map k b -> Map k a + differenceWith :: Ord k => (a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a + differenceWithKey :: Ord k => (k -> a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a + intersection :: Ord k => Map k a -> Map k b -> Map k a + intersectionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c + intersectionWithKey :: Ord k => (k -> a -> b -> c) -> Map k a -> Map k b -> Map k c + mergeWithKey :: Ord k => (k -> a -> b -> Maybe c) -> (Map k a -> Map k c) -> (Map k b -> Map k c) -> Map k a -> Map k b -> Map k c + map :: (a -> b) -> Map k a -> Map k b + mapWithKey :: (k -> a -> b) -> Map k a -> Map k b + traverseWithKey :: Applicative t => (k -> a -> t b) -> Map k a -> t (Map k b) + mapAccum :: (a -> b -> (a, c)) -> a -> Map k b -> (a, Map k c) + mapAccumWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c) + mapAccumRWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c) + mapKeys :: Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a + mapKeysWith :: Ord k2 => (a -> a -> a) -> (k1 -> k2) -> Map k1 a -> Map k2 a + mapKeysMonotonic :: (k1 -> k2) -> Map k1 a -> Map k2 a + foldr :: (a -> b -> b) -> b -> Map k a -> b + foldl :: (a -> b -> a) -> a -> Map k b -> a + foldrWithKey :: (k -> a -> b -> b) -> b -> Map k a -> b + foldlWithKey :: (a -> k -> b -> a) -> a -> Map k b -> a + foldMapWithKey :: Monoid m => (k -> a -> m) -> Map k a -> m + foldr' :: (a -> b -> b) -> b -> Map k a -> b + foldl' :: (a -> b -> a) -> a -> Map k b -> a + foldrWithKey' :: (k -> a -> b -> b) -> b -> Map k a -> b + foldlWithKey' :: (a -> k -> b -> a) -> a -> Map k b -> a + elems :: Map k a -> [a] + keys :: Map k a -> [k] + assocs :: Map k a -> [(k, a)] + toList :: Map k a -> [(k, a)] + fromList :: Ord k => [(k, a)] -> Map k a + fromListWith :: Ord k => (a -> a -> a) -> [(k, a)] -> Map k a + fromListWithKey :: Ord k => (k -> a -> a -> a) -> [(k, a)] -> Map k a + toAscList :: Map k a -> [(k, a)] + toDescList :: Map k a -> [(k, a)] + fromAscList :: Eq k => [(k, a)] -> Map k a + fromAscListWith :: Eq k => (a -> a -> a) -> [(k, a)] -> Map k a + fromAscListWithKey :: Eq k => (k -> a -> a -> a) -> [(k, a)] -> Map k a + fromDistinctAscList :: [(k, a)] -> Map k a + filter :: (a -> Bool) -> Map k a -> Map k a + filterWithKey :: (k -> a -> Bool) -> Map k a -> Map k a + partition :: (a -> Bool) -> Map k a -> (Map k a, Map k a) + partitionWithKey :: (k -> a -> Bool) -> Map k a -> (Map k a, Map k a) + mapMaybe :: (a -> Maybe b) -> Map k a -> Map k b + mapMaybeWithKey :: (k -> a -> Maybe b) -> Map k a -> Map k b + mapEither :: (a -> Either b c) -> Map k a -> (Map k b, Map k c) + mapEitherWithKey :: (k -> a -> Either b c) -> Map k a -> (Map k b, Map k c) + split :: Ord k => k -> Map k a -> (Map k a, Map k a) + splitLookup :: Ord k => k -> Map k a -> (Map k a, Maybe a, Map k a) + splitRoot :: Map k b -> [Map k b] + isSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool + isSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool + isProperSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool + isProperSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool + lookupIndex :: Ord k => k -> Map k a -> Maybe Int + findIndex :: Ord k => k -> Map k a -> Int + elemAt :: Int -> Map k a -> (k, a) + updateAt :: (k -> a -> Maybe a) -> Int -> Map k a -> Map k a + deleteAt :: Int -> Map k a -> Map k a + findMin :: Map k a -> (k, a) + findMax :: Map k a -> (k, a) + deleteMin :: Map k a -> Map k a + deleteMax :: Map k a -> Map k a + deleteFindMin :: Map k a -> ((k, a), Map k a) + deleteFindMax :: Map k a -> ((k, a), Map k a) + updateMin :: (a -> Maybe a) -> Map k a -> Map k a + updateMax :: (a -> Maybe a) -> Map k a -> Map k a + updateMinWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a + updateMaxWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a + minView :: Map k a -> Maybe (a, Map k a) + maxView :: Map k a -> Maybe (a, Map k a) + minViewWithKey :: Map k a -> Maybe ((k, a), Map k a) + maxViewWithKey :: Map k a -> Maybe ((k, a), Map k a) + showTree :: (Show k, Show a) => Map k a -> String + showTreeWith :: (k -> a -> String) -> Bool -> Bool -> Map k a -> String + valid :: Ord k => Map k a -> Bool + + signature MapAsSet where + import Data.Set + + type role Map nominal representational + data Map k a + instance Functor (Map k) + + keysSet :: Map k a -> Set k + fromSet :: (k -> a) -> Set k -> Map k a + +unit app where + dependency sigs[Map=<Map>, MapAsSet=<Map>] + module App where + import Map + + app = do + let x = insert 0 "foo" + . delete 1 + . insert 1 undefined + . insert (6 :: Int) "foo" + $ empty + print (member 1 x) + print (keysSet x) + print (toList x) + print x + +unit main where + dependency app[Map=containers:Data.Map.Lazy] + module Main where + import App + main = app diff --git a/testsuite/tests/backpack/should_run/bkprun06.stdout b/testsuite/tests/backpack/should_run/bkprun06.stdout new file mode 100644 index 0000000000..0d0e0f9383 --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun06.stdout @@ -0,0 +1,4 @@ +False +fromList [0,6] +[(0,"foo"),(6,"foo")] +fromList [(0,"foo"),(6,"foo")] diff --git a/testsuite/tests/backpack/should_run/bkprun07.bkp b/testsuite/tests/backpack/should_run/bkprun07.bkp new file mode 100644 index 0000000000..bfd1cdc4ba --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun07.bkp @@ -0,0 +1,32 @@ +unit a where + module A where + data T = T + deriving (Show) + x = True + y = False + mkT = T + class Foo a where + foo :: a -> a + instance Foo Bool where + foo = not +unit bsig where + signature B where + data T + x :: Bool + mkT :: T + class Foo a where + foo :: a -> a + instance Foo Bool + instance Show T + module App where + import B + y = foo x + app = do + print y + print mkT + print (foo y) +unit main where + dependency bsig[B=a:A] + module Main where + import App + main = app diff --git a/testsuite/tests/backpack/should_run/bkprun07.stdout b/testsuite/tests/backpack/should_run/bkprun07.stdout new file mode 100644 index 0000000000..bb614cd2a0 --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun07.stdout @@ -0,0 +1,3 @@ +False +T +True diff --git a/testsuite/tests/backpack/should_run/bkprun08.bkp b/testsuite/tests/backpack/should_run/bkprun08.bkp new file mode 100644 index 0000000000..022ec52bdc --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun08.bkp @@ -0,0 +1,24 @@ +unit a where + module A where + data T = MkT deriving (Show) + +unit p where + signature ASig1 where + data T + instance Show T + signature ASig2 where + data T + instance Show T + module App where + import qualified ASig1 + import qualified ASig2 + app :: (ASig1.T, ASig2.T) -> IO () + app (t1, t2) = print (show t1, show t2) + +unit main where + dependency p[ASig1=a:A,ASig2=a:A] + dependency a + module Main where + import App + import A + main = app (MkT, MkT) diff --git a/testsuite/tests/backpack/should_run/bkprun08.stdout b/testsuite/tests/backpack/should_run/bkprun08.stdout new file mode 100644 index 0000000000..0281881e29 --- /dev/null +++ b/testsuite/tests/backpack/should_run/bkprun08.stdout @@ -0,0 +1 @@ +("MkT","MkT") |