Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read instance does not work with records #897

Closed
tittoassini opened this issue Nov 8, 2018 · 2 comments
Closed

Read instance does not work with records #897

tittoassini opened this issue Nov 8, 2018 · 2 comments
Labels

Comments

@tittoassini
Copy link

Steps to Reproduce

data REC = REC {l::Int,r::Int} deriving (Read,Show)

main = print (read "REC {l=3,r=4}" :: REC)

Exception in thread "main" eta.runtime.exception.EtaException: Prelude.read: no parse

Your Environment

Did you install an older version of Eta/Etlas before?
Yes, but I removed before installing the latest version.

Current Eta & Etlas version:
eta-0.8.6b2.

etlas version 1.5.0.0
compiled using version 2.1.0.0 of the etlas-cabal library

Operating System and version:
macOS Sierra

@rahulmutt rahulmutt added the bug label Nov 8, 2018
@rahulmutt
Copy link
Member

Was able to reproduce this.

Fastest way to figure out what's happening is to setup a dual eta/stack project and inline the read expression by hand and print out the values of the different components of the read computation and run it with both Eta and Haskell and see where the difference is happening. I suggest you try the dual setup with a resolver from the lts-6* series (GHC 7.10) since the codegen for deriving Read has changed in GHC 8.

Since the Read instance is generated, you'd want to see what the compiler is generating by adding the field ghc-options: -ddump-deriv into your cabal file, and copy/paste and modify it a bit to make it compile with the given input.

Let me know if you need anymore help.

@rahulmutt
Copy link
Member

It turns out that fixing #891 fixed this as well since it was the root cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants