#5499: Tagging constructors with record/product phantom type
----------------------------------+-----------------------------------------
    Reporter:  basvandijk         |        Owner:              
        Type:  feature request    |       Status:  new         
    Priority:  normal             |    Milestone:              
   Component:  libraries (other)  |      Version:  7.2.1       
    Keywords:                     |     Testcase:              
   Blockedby:                     |   Difficulty:              
          Os:  Unknown/Multiple   |     Blocking:              
Architecture:  Unknown/Multiple   |      Failure:  None/Unknown
----------------------------------+-----------------------------------------

Comment(by basvandijk):

 Replying to [comment:6 dreixel]:
 > Right. I believe your `GToJSON` will also need the type-level boolean as
 a class argument.

 I was hoping I could localize this change only to constructors. I think
 it's weird to make a `M1 D` or a `:+:` an instance of `IsRecord`.
 "Recordness" (for lack of a better name) is a property of a constructor,
 not of a datatype or a sum.

 Secondly I see a problem where `GToJSON`
 
[https://github.com/basvandijk/aeson/blob/5bdf30ed4b32f2cc169f6e4e58d1688bcb02c197/Data/Aeson/Types/Internal.hs#L336
 is used]. If `GToJSON` had an extra `b` parameter which value does it get
 in:

 {{{
 class ToJSON a where
     toJSON   :: a -> Value

     default toJSON :: (Generic a, GToJSON (Rep a)) => a -> Value
     toJSON = gToJSON . from
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5499#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to