haskell / haskell/c2hs

"Internal type default error"

Open
#165 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
211
Forks
52
PR merge metrics
No merged PRs in 30d

Description

Hello.

I am using c2hs to generate bindings to Wayland. I came across this unhelpful error message. I consider such a thing as a bug; it has halted me from making progress because I don't know what to do.

```
% c2hs Wayland/Client/Internal/C/Bug.chs
c2hs Wayland/Client/Internal/C/Bug.chs
c2hs: Errors during expansion of binding hooks:

Wayland/Client/Internal/C/Bug.chs:6: (column 3) [ERROR] >>> Internal type default error!
Something went wrong.
```

Here is a minimal example that expresses the bug.

```
-- Bug.chs
module Main where

#include

newtype Bug = Bug { getBug :: {#type uint32_t#} }
{#default in `Bug' [uint32_t] getBug#}
```

And here is the output of `c2hs --version`

```
% c2hs --version
c2hs --version
C->Haskell Compiler, version 0.28.1 Switcheroo, 1 April 2016
build platform is "x86_64-linux" <1, True, True, 1>
```

This is the latest version from Cabal.

Finally, I want to express what I was trying to do; I clearly am trying to do something in a strange way, so I might as well tell you what I **wanted** to have happen.

I have to pass an "opcode" to wayland, represented in the code as a uint32_t. I wanted to newtype over this and create a marshaller as above. I suspect the problem lies in doing weird stuff with newtypes in record syntax with type annotations. If there is a better way, please let me know.

Hope this has been helpful.

Sincerely,
Matt

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.