[GHC] #12998: libraries/base/System/Posix/Types.hs: tries to define Floating instance for opaque type

GHC ghc-devs at haskell.org
Sat Dec 17 23:04:59 UTC 2016


#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
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I've noticed it as a build failure on openbsd-6 but on linux behaviour is
 strange as well.

 Build failure:

 {{{
 libraries/base/System/Posix/Types.hs:217:100: error:
     * No instance for (Fractional Int32)
         arising from the 'deriving' clause of a data type declaration
       Possible fix:
         use a standalone 'deriving instance' declaration,
           so you can specify the instance context yourself
     * When deriving the instance for (Fractional CTimer)
 }}}

 On openbsd-6.0 timer_t is an int32:
 {{{
 # gcc -E /usr/include/time.h | grep timer_t
 typedef __int32_t __timer_t;
 typedef __timer_t timer_t;
 }}}

 On amd64-linux-glibc it's void*:
 {{{
 $ gcc -E /usr/include/time.h | grep timer_t
 typedef void * __timer_t;
 typedef __timer_t timer_t;
 }}}

 But base's configure detects it as Double (by chance) on amd64-linux-
 glibc.

 {{{
 System.Posix.Types> :t CTimer
 CTimer :: Double -> CTimer
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12998>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list