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_compile/bkp32.bkp | |
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_compile/bkp32.bkp')
-rw-r--r-- | testsuite/tests/backpack/should_compile/bkp32.bkp | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/testsuite/tests/backpack/should_compile/bkp32.bkp b/testsuite/tests/backpack/should_compile/bkp32.bkp new file mode 100644 index 0000000000..92f37a5a05 --- /dev/null +++ b/testsuite/tests/backpack/should_compile/bkp32.bkp @@ -0,0 +1,92 @@ +{-# LANGUAGE RoleAnnotations #-} +{-# LANGUAGE ScopedTypeVariables #-} +unit prelude-sig where + signature Prel where + data List a = Nil | Cons a (List a) + +unit arrays-sig where + dependency prelude-sig[Prel=<Prel>] + signature Array where + import Prel + data Arr i e + something :: List (Arr i e) + +unit structures where + dependency arrays-sig[Prel=<Prel>, Array=<Array>] + module Set where + import Prel + data S a = S (List a) + module Graph where + import Prel + import Array + data G = G (Arr Int [Int]) + module Tree where + import Prel + import Graph + data T = T G + +unit arrays-a where + dependency prelude-sig[Prel=<Prel>] + module Array where + import qualified Prel as P + type role Arr representational representational + data Arr i e = MkArr () + something :: P.List (Arr i e) + something = P.Nil + +unit arrays-b where + dependency prelude-sig[Prel=<Prel>] + module Array where + import Prel + data Arr i e = ANil | ACons i e (Arr i e) + -- NB: If you uncomment this, GHC decides to order the + -- quantifiers the other way, and you are a sad panda. + something :: Prel.List (Arr i e) + something = Cons ANil Nil + +unit graph-a where + dependency arrays-a[Prel=<Prel>] + dependency structures[Prel=<Prel>,Array=arrays-a[Prel=<Prel>]:Array] (Graph) + +unit graph-b where + dependency arrays-b[Prel=<Prel>] + dependency structures[Prel=<Prel>,Array=arrays-b[Prel=<Prel>]:Array] (Graph) + +unit multiinst where + dependency arrays-a[Prel=<Prel>] (Array as AA) + dependency arrays-b[Prel=<Prel>] (Array as AB) + dependency structures[Prel=<Prel>,Array=arrays-a[Prel=<Prel>]:Array] (Graph as GA) + dependency structures[Prel=<Prel>,Array=arrays-b[Prel=<Prel>]:Array] (Graph as GB) + module Client where + import qualified GA + import qualified GB + x = GA.G + y = GB.G + instance Show GA.G where + show = undefined + instance Show GB.G where + show = undefined + +unit applic-left where + dependency arrays-a[Prel=<Prel>] + dependency structures[Prel=<Prel>,Array=arrays-a[Prel=<Prel>]:Array] (Graph) + module Left where + import Graph + x :: G + x = undefined + +unit applic-right where + dependency arrays-a[Prel=<Prel>] + dependency structures[Prel=<Prel>,Array=arrays-a[Prel=<Prel>]:Array] (Graph) + module Right where + import Graph + f :: G -> G + f = id + +unit applic-bot where + dependency applic-left[Prel=<Prel>] + dependency applic-right[Prel=<Prel>] + module Bot where + import Left + import Right + g = f x |