Questions tagged [ghc-generics]

Generic programming support in GHC allows defining classes with methods that do not need a user specification when instantiating: the method body is automatically derived by GHC. This is similar to what happens for standard classes such as Read and Show, for instance, but now for user-defined classes.

See also:

33 questions
1
vote
1 answer

Adding a Show constraint when using GHC.Generics

I am using GHC Generics. My use case is almost identical to the example in the wiki, except that I am encoding and decoding gene sequences. This was all working fine, until I decided to keep a list of what I'd already read, so that I could report…
mhwombat
  • 8,026
  • 28
  • 53
1
vote
1 answer

Deriving Generic from data declared in another file fails

I have these two modules: module Server where import Data.JSON.Schema.Generic (gSchema) import Data.JSON.Schema.Types (JSONSchema(schema)) import Two instance JSONSchema Data where schema = gSchema main :: IO () main = undefined {-# LANGUAGE…
ryskajakub
  • 6,351
  • 8
  • 45
  • 75
0
votes
1 answer

How to use syb mkM

I just discovered power of syb library and trying to find its limits. I've got everywhere working: > :set -XDeriveDataTypeable > :set -XGeneralizedNewtypeDeriving > import Data.Generics > newtype MyInt = MyInt Int deriving (Show, Eq, Num, Ord,…
Daniil Iaitskov
  • 5,525
  • 8
  • 39
  • 49
1 2
3