<div dir="ltr">type EpochTime = CTime<div>newtype CTime = CTime Int64</div><div><br></div><div>You can just pattern match.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 15, 2015 at 5:42 PM, Bram Neijt <span dir="ltr"><<a href="mailto:bneijt@gmail.com" target="_blank">bneijt@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Haskell cafe,<br>
<br>
I want to convert form<br>
<br>
mtime :: System.Posix.Types.EpochTime<br>
<br>
to something aeson can eat without having to define an instance. I<br>
choose Integer.<br>
<br>
My current solution[1] is just using (read . show). I know, ugly, but<br>
the only thing I could get going.<br>
<br>
What is the proper way to convert System.Posix.Types.EpochTime to<br>
Integer or something else aeson will automatically convert without<br>
making a ToJSON instance?<br>
<br>
As a beginner I wonder: is there a general way to go about finding<br>
conversion paths between types?<br>
<br>
<br>
Greetings,<br>
<br>
Bram Neijt<br>
<br>
[1] <a href="https://github.com/bneijt/httpmtimeline/blob/master/src/Main.hs#L21" rel="noreferrer" target="_blank">https://github.com/bneijt/httpmtimeline/blob/master/src/Main.hs#L21</a><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div>