acid-state / safecopy

An extension to Data.Serialize with built-in version control
60 stars 37 forks source link

safecopy added dependency on generic-data which is only GHC >= 8.0 #73

Open phadej opened 5 years ago

phadej commented 5 years ago

See https://matrix.hackage.haskell.org/#/package/generic-data

safecopy however says

base >=4.5 && <5,

which should be bumped to >=4.9

Also there are conditionals like

  if !impl(ghc > 8.0)
    Build-Depends:     semigroups >= 0.18 && < 0.19

  if(impl(ghc >= 7.2.1))
    cpp-options: -DDEFAULT_SIGNATURES

  if(impl(ghc >= 7.1))
    cpp-options: -DSAFE_HASKELL

which could be cleaned up

ddssff commented 5 years ago

I think adding the generic-data dependency may have been a mistake on my part. I'll check it out.

ddssff commented 5 years ago

At first glance generic-data does look like the best substitute for template Haskell. Its used to compute the number of constructors in a type and the index of a value's constructor. Syb is an alternative, but my understanding is that it is slower.

ddssff commented 5 years ago

base 4.9 puts template haskell at 2.13 I believe.

ddssff commented 5 years ago

:thinking:

-- Hack for bug in older Cabal versions
#ifndef MIN_VERSION_template_haskell
#define MIN_VERSION_template_haskell(x,y,z) 1
#endif
phadej commented 5 years ago

There's no problem in depending on generic-data. GHC.Generics is nice tool.

There's just quite a lot of cleanup to be made. e.g. there is

#if !MIN_VERSION_base(4,8,0)

or

#ifdef DEFAULT_SIGNATURES

in the code.

EDIT: there seems to be TypeApplications used e.g. so looks like you are commited to GHC-8.0+ anyway, so even it's possible to push support back to ~7.6 or 7.4, it's maybe no worth it.

ddssff commented 5 years ago

I've pushed a patch to https://github.com/ddssff/safecopy and made a pull request. Please have a look!