diff options
author | Niklas Haas <git@nand.wakku.to> | 2014-02-23 15:37:13 +0100 |
---|---|---|
committer | Niklas Haas <git@nand.wakku.to> | 2014-02-23 15:37:13 +0100 |
commit | 64850ca4f7dc2ca0fdb21d078d93cd636de5c87a (patch) | |
tree | 294c6f3115b29620ed7b4cd9bf3b5a5f93a5c289 /html-test/src/TypeOperators.hs | |
parent | 14531f7838c5abd0ba2aaf5217a477194d7b1897 (diff) |
Lower precedence of equality constraints
This drops them to the new precedence pREC_CTX, which makes single
eqaulity constraints show up as (a ~ b) => ty, in line with GHC's
rendering. Additional tests added to make sure other type operators
render as intended. Current behavior matches GHC
Diffstat (limited to 'html-test/src/TypeOperators.hs')
-rw-r--r-- | html-test/src/TypeOperators.hs | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/html-test/src/TypeOperators.hs b/html-test/src/TypeOperators.hs index edbb9344..e69e89cb 100644 --- a/html-test/src/TypeOperators.hs +++ b/html-test/src/TypeOperators.hs @@ -1,12 +1,5 @@ -{-# LANGUAGE TypeOperators #-} -module TypeOperators ( - -- * stuff - (:-:), - (:+:), - Op, - O(..), - biO, -) where +{-# LANGUAGE TypeOperators, GADTs, MultiParamTypeClasses, FlexibleContexts #-} +module TypeOperators where data a :-: b @@ -16,5 +9,19 @@ data a `Op` b newtype (g `O` f) a = O { unO :: g (f a) } +class a <=> b + biO :: (g `O` f) a biO = undefined + +f :: (a ~ b) => a -> b +f = id + +g :: (a ~ b, b ~ c) => a -> c +g = id + +x :: ((a :-: a) <=> (a `Op` a)) => a +x = undefined + +y :: (a <=> a, (a `Op` a) <=> a) => a +y = undefined |