[Haskell-cafe] Converting EpochTime to Integer
kane at kane.cx
Tue Sep 15 16:48:46 UTC 2015
EpochTime is an instance of Integral. You can just use toInteger ::
Integral a => a -> Integer.
On 9/15/2015 6:42 PM, Bram Neijt wrote:
> Dear Haskell cafe,
> I want to convert form
> mtime :: System.Posix.Types.EpochTime
> to something aeson can eat without having to define an instance. I
> choose Integer.
> My current solution is just using (read . show). I know, ugly, but
> the only thing I could get going.
> What is the proper way to convert System.Posix.Types.EpochTime to
> Integer or something else aeson will automatically convert without
> making a ToJSON instance?
> As a beginner I wonder: is there a general way to go about finding
> conversion paths between types?
> Bram Neijt
>  https://github.com/bneijt/httpmtimeline/blob/master/src/Main.hs#L21
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4291 bytes
Desc: S/MIME Cryptographic Signature
More information about the Haskell-Cafe