
#12998: libraries/base/System/Posix/Types.hs: tries to define Floating instance for opaque type -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: DanielG (added) Comment: As I note [https://phabricator.haskell.org/rGHCffc2327070dbb664bdb407a804121eacb2a7c734 here], a quick-and-dirty fix would be to introduce a macro `OPAQUE_TYPE_WITH_CTYPE` in `CTypes.h`: {{{#!hs #define OPAQUE_CLASSES Eq,Ord,Storable #define OPAQUE_TYPE_WITH_CTYPE(T,THE_CTYPE,B) \ newtype {-# CTYPE "THE_CTYPE" #-} T = T B \ deriving (OPAQUE_CLASSES) \ deriving newtype (Read, Show); }}} And then use that on `CTimer` instead of `FLOATING_TYPE_WITH_CTYPE`. Of course, this doesn't fix the infelicity that the underlying representation of `CTimer` is still not a `Ptr ()`, which would require fixing the `FPTOOLS_CHECK_HTYPE_ELSE` [http://git.haskell.org/ghc.git/blob/ffc2327070dbb664bdb407a804121eacb2a7c734... M4 macro] in `libraries/base/aclocal.m4` to remedy. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12998#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler