visq / language-c

Source repository for https://hackage.haskell.org/package/language-c
http://visq.github.io/language-c/
Other
87 stars 45 forks source link

[syntax] GHC.Generics.Generic and Control.DeepSeq.NFData instances #49

Closed lambdageek closed 6 years ago

lambdageek commented 6 years ago

Fixes #48

visq commented 6 years ago

Supporting deepseq sounds like a good idea.

@lambdageek:

lambdageek commented 6 years ago
  1. Language extensions to .cabal - okay, I updated the PR.

  2. I decided to drop the NFData1 instances. I didn't realize the NFData1 class is so new. There are also a few data types in Language.C.Syntax.AST for which GHC can't derive Generic1 and therefore we can't use the default NFData1 instance. As a result there were only a handful of inconsequential NFData1 instances.

  3. GHC.Generics is part of base >= 4.6.0.0 (GHC 7.2.1) although the GHC manual for that release mentions that deriving Generic1 didn't work at the time, so that came along later. We're only testing on Travis as far back as GHC 7.8, but it looks like the .cabal file wants to support some older versions too. Should I put the Generic instances behind an #ifdef?

visq commented 6 years ago

Support for 7.6 (> 5 years ago) or newer seems sufficient, you could also support 7.4 by adding a dependency on ghc-prim (judging from https://hackage.haskell.org/package/deepseq-1.4.3.0/deepseq.cabal). I think #ifdefs are not necessary; if we support a compiler different from GHC at some point (and have a test for it), we can introduce the necessary changes. @lambdageek Could you also remove the splitBase stuff from .cabal? It is no longer needed if we only support 7.x or newer.

lambdageek commented 6 years ago

Updated.