Properly introduce CTimer to System.Posix.Types
authorRyan Scott <ryan.gl.scott@gmail.com>
Sun, 15 Jan 2017 16:53:34 +0000 (11:53 -0500)
committerRyan Scott <ryan.gl.scott@gmail.com>
Sun, 15 Jan 2017 16:53:34 +0000 (11:53 -0500)
commitdb91d17edfbe7deecb62bbb89c804249f9c4a4bd
tree7c01e3256c19a009625f96bc5e977ac5b673cd4c
parent331f88d0d878eae926b3c1c61a3ff344916b62ed
Properly introduce CTimer to System.Posix.Types

Summary:
In ffc2327070dbb664bdb407a804121eacb2a7c734, an attempt was made at
adding a Haskell wrapper around the C `timer_t` type. Unfortunately, GHC's
autoconf macros weren't sophisticated enough at the time to properly detect
that `timer_t` is represented by a `void *` (i.e., a pointer) on most OSes.

This is a second attempt at `CTimer`, this time using `AC_COMPILE_IFELSE` to
detect if a type is a pointer type by compiling the following program:

```
type val;
*val;
```

This also only derives a small subset of class instances for `CTimer` that are
known to be compatible with `Ptr` using a new `OPAQUE_TYPE_WITH_CTYPE` macro.

Test Plan: ./validate

Reviewers: erikd, hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2952

GHC Trac Issues: #12795, #12998
libraries/base/System/Posix/Types.hs
libraries/base/aclocal.m4
libraries/base/changelog.md
libraries/base/configure.ac
libraries/base/include/CTypes.h