Old code broken by new Typeable class
Carter Schonwald
carter.schonwald at gmail.com
Tue Aug 5 16:49:29 UTC 2014
more concretely
#if defined(__GLASGOW_HASKELL__) && ( __GLASGOW_HASKELL__ >= 707)
--- do the deriving version here
#else
--- your current stuff
#endif
On Tue, Aug 5, 2014 at 12:46 PM, Carter Schonwald <
carter.schonwald at gmail.com> wrote:
> i assume 7.6 and 7.8, if we're talking GHC rather than GCC :)
>
> in 7.8 you can't define userland typeable instances, you need only write
> deriving (Typeable) and you're all set.
> add some CPP to select the instances suitable
>
>
> On Tue, Aug 5, 2014 at 12:41 PM, Volker Wysk <verteiler at volker-wysk.de>
> wrote:
>
>> Hi!
>>
>> I've been working with GHC-4.6.3, and updating to GHC-4.8.3 breaks my
>> code,
>>
>> because the Typeable class has been changed. The compiler produces this
>>
>> message:
>>
>> ---------
>>
>> src/HsShellScript/ProcErr.chs:2294:4:
>>
>> ‘typeOf’ is not a (visible) method of class ‘Typeable’
>>
>> ---------
>>
>> I want to define System.Posix.Process.ProcessStatus to be an instance of
>>
>> Typeable, so I can throw and catch it as an exception. ProcessStatus
>> isn't
>>
>> typeable by default.
>>
>> Is it still possible to make ProcessStatus a member of Typeable? How?
>>
>> Obviously, you can't accomplish it by deriving Typeable, because the
>> definition
>>
>> can't be changed any longer.
>>
>> This is the spot in question:
>>
>> ----------
>>
>> import System.Posix.Process
>>
>> import Data.Typeable
>>
>> {-
>>
>> data ProcessStatus = Exited ExitCode
>>
>> | Terminated Signal
>>
>> | Stopped Signal
>>
>> deriving (Eq, Ord, Show)
>>
>> -}
>>
>> instance Typeable ProcessStatus where
>>
>> typeOf = const tyCon_ProcessStatus
>>
>> tyCon_ProcessStatus = mkTyConApp (mkTyCon3 "hsshellscript"
>>
>> "HsShellScript.ProcErr"
>>
>> "Posix.ProcessStatus") []
>>
>> instance Exception ProcessStatus
>>
>> ----------
>>
>> Thanks,
>>
>> V.W.
>>
>> _______________________________________________
>> Glasgow-haskell-users mailing list
>> Glasgow-haskell-users at haskell.org
>> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20140805/e9a59c57/attachment.html>
More information about the Glasgow-haskell-users
mailing list