This isn't a type-soundness bug; but it could be considered a user-interface sort of bug. After all, it's caused users to be puzzled. It arises really because it was convenient for the implementation.
Do go ahead and file it as a Trac bug if it tripped you up enough to be worth fixing. A fix should not take long, but might be a bit fiddly. Simon | -----Original Message----- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco | Túlio Gontijo e Silva | Sent: 25 January 2007 12:57 | To: haskell-cafe | Subject: Re: [Haskell-cafe] Type infer | | Em Qua, 2007-01-24 às 20:36 -0500, Bryan Donlan escreveu: | > Marco Túlio Gontijo e Silva wrote: | > > Hello, | > > | > > I'm trying to define a partition__ function that is like | > > Data.Set.partition, but use State Monad: | > > | > >> import Data.Set | > >> import Control.Monad.State | > > | > >> partition__ f = | > >> do | > >> snapshot <- get | > >> let | > >> (firsts, rest) = Set.partition f snapshot | > >> put rest | > >> return firsts | > > | > > When I try to infer it's type in ghci I got: | > > | > > $ ghci | > > ___ ___ _ | > > / _ \ /\ /\/ __(_) | > > / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98. | > > / /_\\/ __ / /___| | http://www.haskell.org/ghc/ | > > \____/\/ /_/\____/|_| Type :? for help. | > > | > > Loading package base ... linking ... done. | > > Prelude> :load partition.hs | > > [1 of 1] Compiling Main ( partition.hs, interpreted ) | > > Ok, modules loaded: Main. | > > *Main> :type partition__ | > > partition__ :: (MonadState (Set a) t, Ord a) => (a -> Bool) -> t (Set a) | > > | > > Ok, then I add | > > | > >> partition__ :: (MonadState (Set a) t, Ord a) => (a -> Bool) -> t (Set | > > a) | > > | > > to the file and then: | > > | > > *Main> :reload | > > [1 of 1] Compiling Main ( partition.hs, interpreted ) | > > | > > partition.hs:4:0: | > > Non type-variable argument in the constraint: MonadState (Set a) t | > > (Use -fglasgow-exts to permit this) | > > In the type signature for `partition__': | > > partition__ :: (MonadState (Set a) t, Ord a) => | > > (a -> Bool) -> t (Set a) | > > Failed, modules loaded: none. | > > | > > Why do I need glasgow-exts to specify a type infered by GHCi without | > > -fglasgow-exts? | > | > I'd imagine the check that you're using -fglasgow-exts is performed when | > parsing type signatures from the parser. When you allow GHC to infer the | > type, it's pulling that from Control.Monad.State, which was compiled | > with -fglasgow-exts - it's simply not checking that all the types you | > might infer from there are legal without -fglasgow-exts. | | Makes sense, but isn't it a bug? It shouldn't be able infer types that | are not allowed without -fglasgow-exts, right? | | Thanks. | | -- | malebria | Marco Túlio Gontijo e Silva | Correio (MSN): [EMAIL PROTECTED] | Jabber (GTalk): [EMAIL PROTECTED] | Ekiga: [EMAIL PROTECTED] | IRC: [EMAIL PROTECTED] | [EMAIL PROTECTED] | Skype: marcotmarcot | Telefone: 33346720 | Celular: 98116720 | Endereço: | Rua Paula Cândido, 257/201 | Gutierrez 30430-260 | Belo Horizonte/MG Brasil | | _______________________________________________ | Haskell-Cafe mailing list | Haskell-Cafe@haskell.org | http://www.haskell.org/mailman/listinfo/haskell-cafe _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe