Coder Social home page Coder Social logo

data-default's People

Contributors

abbradar avatar jaspervdj avatar mauke avatar sol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

data-default's Issues

Remove most instances

My opinion: def is a useful concept for blobs of optional parameters, configs, and perhaps other domain-specific things, but not for numeric types, lists, Maybe, etc.

The situation today is, from my vantage point: either people avoid this type class entirely (e.g. google/proto-lens#194), or they use it with some caveats like, try not to abuse it.

I propose we try to correct this by making a major version bump to 2.0 and removing most instances. The only ones I believe belong are the derived tuple instances like

instance (Default a, Default b) => Default (a, b)

What do you think? Is this a feasible or wanted change? Thanks :)

stack build tools support

Please refresh your library dependencies to become compatible with stack tools. It guess it should compiles with latest versions of cabal packages

Add GDefault instance for (a :+: b)

The usefulness of the Default class came from its ability to generically derive Default instances. I would argue that adding a GDefault instance for sum types (which selects the first constructor) would further boost its usefulness. Plus we lose nothing from adding this since right now we need to manually write Default instances for sum types anyways.

Is Default (e -> r) necessary?

Do you personally use the (e -> r) instance? Do you know if anybody else does? I'm trying to define:

data Preference = Preference 
  { userId :: UserId
  , max   :: Int
  }

Obviously, the UserId can't be defaulted (sensibly -- i.e., while respecting the app's semantics for a UserId), but it would be pretty nice to be able to define:

instance Default (UserId -> Preference) where
  def = \uid -> (Preference uid 1000)

Default for `Proxy`

It would be useful to have a default for Proxy

instance Default (Proxy a) where def = Proxy

Add to stackage

Hello, this library looks really good to me and i would like to use it in my haskell stack project. Could it be added to stackage ?

Merge packages data-default-class and data-default-instances-base

I may be missing something, but as I see it the reason to split the original data-default into separate packages is to minimize dependencies.

As both data-default-class and data-default-instances-base only introduce the base dependency, we could merge the packages.

Keeping the separate packages has the downside that the instances in data-default-instances-base are orphan (which I generally considered undesirable). Are there any upsides?

Drop the instance for function

The current instance isn't very useful and it occupies the space for a whole universe of way more useful default morphism instances, e.g.:

instance Default (Int8 -> Int) where def = fromIntegral
instance Default (String -> Data.Text.Text) where def = Data.Text.pack

Basically, the whole "conversion" ecosystem could be encoded this way.

data-default-class-0.1.0 is missing GHC.Generics support for GHC 7.4

This has the unfortunate effect of violating the PVP contract, as data-default-class-0.1.0 lacks Generics support for GHC 7.4 even though GHC 7.4 does support Generics and will result in hard to fix install-plan issues on Hackage if left un-addressed.

My recommendation is to quickly release data-default-class-0.1.0.1 providing Generics support for GHC 7.4. I can provide a PR if needed.

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.