[Haskell-cafe] Explicit forall - Strange Error

2012-07-31 Thread Shayan Najd Javadipour
Hi, I wonder why the following code doesn't typecheck in GHC 7.4.1: {-# LANGUAGE GADTs,RankNTypes #-}data T a where T1 :: (forall b. b - b) - (forall a. Int - T a) {- Error: Data constructor `T1' returns type `forall a. Int - T a' instead of an instance of its parent type `T a' In the

Re: [Haskell-cafe] Explicit forall - Strange Error

2012-07-31 Thread MigMit
It really seems to me that the error message you've got explains everything quite clear. Отправлено с iPad 31.07.2012, в 22:59, Shayan Najd Javadipour sh.n...@gmail.com написал(а): Hi, I wonder why the following code doesn't typecheck in GHC 7.4.1: {-# LANGUAGE GADTs,RankNTypes #-}

Re: [Haskell-cafe] Explicit forall - Strange Error

2012-07-31 Thread Shayan Najd Javadipour
If GHC handles the explicit forall in constructor T1 in the same way as it does for function f, we have: data T a where T1 :: (forall b. b - b) - Int - T a Which is totally fine! The main question is then why the foralls are handled differently? On Tue, Jul 31, 2012 at 9:07 PM, MigMit

Re: [Haskell-cafe] Explicit forall - Strange Error

2012-07-31 Thread Brandon Allbery
On Tue, Jul 31, 2012 at 2:59 PM, Shayan Najd Javadipour sh.n...@gmail.comwrote: {-# LANGUAGE GADTs,RankNTypes #-}data T a where T1 :: (forall b. b - b) - (forall a. Int - T a) {- Error: Data constructor `T1' returns type `forall a. Int - T a' instead of an instance of its parent type