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

Data.Generics.Any: Undefined field inside compose0, :% :: Ratio Int #24

Closed
andre-van-delden opened this issue May 21, 2015 · 1 comment

Comments

@andre-van-delden
Copy link

Getting a runtime error on:

{-# LANGUAGE DeriveDataTypeable -}
module Main where

import Data.Ratio
import System.Console.CmdArgs

data Options = Options { r :: Ratio Int
                                      } deriving (Show, Data, Typeable)

defaultOptions = Options { r = 4 % 7 }

main = print =<< cmdArgs defaultOptions

The error message is:
Data.Generics.Any: Undefined field inside compose0, :% :: Ratio Int

@ndmitchell
Copy link
Owner

The problem is that Ratio is defined with strict fields, specifically:

data  Ratio a = !a :% !a  deriving (Eq)

And that plays havoc with certain types of Data operations. Fortunately, I was able to fix it up relatively easily in this instance. I've released 0.10.13 with the fix.

While it's fixed, I didn't really expect people to pass Ratio on the command line, and it might not be as useful as you would hope.

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Jun 4, 2015
CHANGES:
0.10.13
    #24, support Ratio in some places
    ndmitchell/cmdargs#24
0.10.12
    GHC 7.2 compatibility
0.10.11
    #15, never put [brackets] around optional args in Explicit
    ndmitchell/cmdargs#15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants