Giter VIP home page Giter VIP logo

Comments (7)

mike-burns avatar mike-burns commented on July 17, 2024

I've pushed this to master.

from github.

mike-burns avatar mike-burns commented on July 17, 2024

Re-opening because, well, that broke everything.

from github.

mike-burns avatar mike-burns commented on July 17, 2024

I've pushed this to master: derive Read for each data type except Error.

from github.

sol avatar sol commented on July 17, 2024

The Read instances take horribly long to compile with -O (the default with cabal install). Removing them cuts down compilation time of "Github/Data/Definitions.hs" from 1m18s to 17s (with ghc-7.4, with ghc-7.0.4 it was over 3 minutes); -O0 also helps a lot.

@mike-burns @joeyh can you verify this?

As far as I know, Read is not very popular, because derived instances have the reputation to be very slow. There is even something on that in the Report ("The parsing techniques used by the reader are very inefficient; reading a large structure may be quite slow.").

Maybe adding ToJSON instances would be a more useful alternative (would also close #9). We may need some of them anyway, when adding support for POST/PATCH requests.

@joeyh would JSON serialization/deserialization be suitable for your use case, or do you rely on Read for some reason?

from github.

joeyh avatar joeyh commented on July 17, 2024

Simon Hengel wrote:

@joeyh would JSON serialization/deserialization be suitable for your use case, or do you rely on Read for some reason?

I'd be happy with JSON serialization.

see shy jo

from github.

sol avatar sol commented on July 17, 2024

It should be possible to automatically derive FromJSON/ToJSON with template Haskell.

module Util where

import qualified Data.Char as Char

convertCamelCase :: String -> String
convertCamelCase = foldr f []
  where
    f x xs
      | Char.isUpper x = '_' : Char.toLower x : xs
      | otherwise      = x : xs

An then the following should work:

$(deriveJSON (drop 5 . convertCamelCase) ''Repo)

from github.

mike-burns avatar mike-burns commented on July 17, 2024

Closing this issue as a duplicate of #9. I've removed the Read instances from master.

from github.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.