haskell / haskell/network

PatternSynonyms vs Show/Read

Open
#463 16 comments 0 reactions 1 assignee Claimed by @kazu-yamamoto View on GitHub
Dominant language
Haskell
Stars
366
Forks
210
Avg merge
22h 38m
Merged PRs (30d)
5

Description

`PatternSynonyms` solves the problem of closed sum types. However, it introduced a possible backward compatibility issue relating to `Show` and `Read`:

```
> import Network.Socket
> ReuseAddr
SockOpt {sockOptLevel = 65535, sockOptName = 4}
> show ReuseAddr
"SockOpt {sockOptLevel = 65535, sockOptName = 4}"
> read "ReuseAddr" :: SocketOption
:4:1: error:
• No instance for (Read SocketOption) arising from a use of ‘read’
• In the expression: read "ReuseAddr" :: SocketOption
In an equation for ‘it’: it = read "ReuseAddr" :: SocketOption
```

It's easy to fix this issue by adding `Read` and `Show` instance by hand. I would like to discuss it's worth doing.

Relating to #459.

Cc: @vdukhovni, @eborden

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.