[Haskell-cafe] Generalizing a library

Adam Bergmark adam at bergmark.nl
Wed Jun 24 08:57:10 UTC 2015


The way Fay handles this is to set the `FAY` variable for CPP so you can
use `#ifdef FAY`. I then usually have a module Foo.GHC and Foo.Fay imported
conditionally. Perhaps something similar is applicable here?

HTH,
Adam


On Wed, Jun 24, 2015 at 10:30 AM, Geraldus <heraldhoi at gmail.com> wrote:

> Hi Cafe!
>
> I've written very first version of GHCJS port
> <https://github.com/geraldus/ghcjs-perch> of Perch
> <https://github.com/agocorona/haste-perch> library originally designed to
> work with Haste compiler.  Most of work is already done, though some
> polishing is needed.  In essence Haste and GHCJS versions are very similar,
> the major difference is how foreign functions are defined, and in fact
> Perch is built using just a few low-level primitives
> <https://github.com/geraldus/ghcjs-perch/blob/master/src/Internal/FFI.hs>.
>
> So, as these libraries are very similar I want to generalize Perch to make
> it independent of compiler somehow.
>
> My initial idea was to have a Perch library and several compiler specific
> back-ends which user should select depending on his toolchain, but my
> Haskell skills are still very poor to find a proper way to do this.  Can
> someone point me in right direction or at least give some advices?
>
> Very appreciate any help!
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150624/6be2cb0a/attachment.html>


More information about the Haskell-Cafe mailing list