Topic/jnumber

Well, the situation before was exactly the same. JsonNumber was just a
Double, and if you called toInt on that, you'd get the same results as
you're getting now.

On Thu, Sep 25, 2014 at 12:26 PM, Sean Parsons <notifications@github.com>
wrote:

> In src/main/scala/argonaut/JsonNumber.scala:
>
> > @@ -0,0 +1,87 @@
> > +package argonaut
> > +
> > +import scalaz.Equal
> > +import scalaz.Scalaz._
> > +import monocle.function._
> > +import monocle.std._
> > +
> > +/**
> > + * JSON numbers with optimization by cases.
> > + * Note: Javascript numbers are 64-bit decimals.
> > + */
> > +sealed abstract class JsonNumber {
> > +  import Json._
> > +
> > +  def toDouble: Double
>
> Knowing human behaviour I think people will call .toInt in their code and
> then log bugs because it's returning -1 for Long.MaxValue, that kind of
> thing. But we can just have it as "def toInt: Option[Int]" to get the nice
> name and type. :)
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/argonaut-io/argonaut/pull/140/files#r18042503>.
>