<div><div dir="auto">Hi,</div></div><div dir="auto"><br></div><div dir="auto">Have you looked into Apache thrift (<div><a href="https://thrift.apache.org">https://thrift.apache.org</a></div>)? You’d provide interface definitions and the thrift compiler generates client/server code from those. If the overhead of that is intolerable and you really want to call functions “directly”, you could try exporting haskell functions to c and then writing bindings to that for your language, e.g. using the python c api or JNI. I’m just not sure how one’s supposed to ensure initialization of the haskell runtime in any case.</div><div dir="auto"><br></div><div dir="auto">Good luck</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 29, 2019 at 5:00 AM <<a href="mailto:beginners-request@haskell.org">beginners-request@haskell.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send Beginners mailing list submissions to<br>
<a href="mailto:beginners@haskell.org" target="_blank">beginners@haskell.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:beginners-request@haskell.org" target="_blank">beginners-request@haskell.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:beginners-owner@haskell.org" target="_blank">beginners-owner@haskell.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Beginners digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Providing Haskell Libraries wrapped for other Languages<br>
(Leonhard Applis)<br>
2. Re: Providing Haskell Libraries wrapped for other Languages<br>
(Simon Jakobi)<br>
3. strange error inside a case (PICCA Frederic-Emmanuel)<br>
4. Re: strange error inside a case (Sylvain Henry)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Thu, 28 Nov 2019 14:15:27 +0000<br>
From: Leonhard Applis <<a href="mailto:Leonhard.Applis@protonmail.com" target="_blank">Leonhard.Applis@protonmail.com</a>><br>
To: "<a href="mailto:beginners@haskell.org" target="_blank">beginners@haskell.org</a>" <<a href="mailto:beginners@haskell.org" target="_blank">beginners@haskell.org</a>><br>
Subject: [Haskell-beginners] Providing Haskell Libraries wrapped for<br>
other Languages<br>
Message-ID:<br>
<GWMEmGPietL5BGMOXNm_vOI1zYWXem1x6GOctodu3ftdJVurBPz36E5Jjq_lzGz7XC4t1CNeY-XajQCrh0j4NKVFXBTTGG4pBmJL6bh4U4s=@<a href="http://protonmail.com" rel="noreferrer" target="_blank">protonmail.com</a>><br>
<br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi, <br>
I am currently writing a small library. I will provide a small web-api for it, however I have some colleagues who neither have experience in haskell, nor in web-dev. <br>
Also they maybe want to produce programs using my library without internet / docker / etc. <br>
<br>
So in addition I'd like to provide the library "wrapped" for other languages, especially python, but maybe java as well. <br>
These wrappers should do nothing except invoking their pardons on the library, and should somewhat contain the library. <br>
<br>
What is the common way to do this? <br>
I've seen "hyphen" as a super heavyweight solution, and I've seen people starting the haskell library listening on system-pipes. <br>
I don't feel that these are the "best" solutions, atleast for my intention. <br>
<br>
best regards<br>
Leonhard<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mail.haskell.org/pipermail/beginners/attachments/20191128/38f52f24/attachment-0001.html" rel="noreferrer" target="_blank">http://mail.haskell.org/pipermail/beginners/attachments/20191128/38f52f24/attachment-0001.html</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: publickey - <a href="mailto:Leonhard.Applis@protonmail.com" target="_blank">Leonhard.Applis@protonmail.com</a> - 0x807FDDF3.asc<br>
Type: application/pgp-keys<br>
Size: 1843 bytes<br>
Desc: not available<br>
URL: <<a href="http://mail.haskell.org/pipermail/beginners/attachments/20191128/38f52f24/attachment-0001.key" rel="noreferrer" target="_blank">http://mail.haskell.org/pipermail/beginners/attachments/20191128/38f52f24/attachment-0001.key</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: signature.asc<br>
Type: application/pgp-signature<br>
Size: 477 bytes<br>
Desc: OpenPGP digital signature<br>
URL: <<a href="http://mail.haskell.org/pipermail/beginners/attachments/20191128/38f52f24/attachment-0001.sig" rel="noreferrer" target="_blank">http://mail.haskell.org/pipermail/beginners/attachments/20191128/38f52f24/attachment-0001.sig</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Thu, 28 Nov 2019 16:43:30 +0100<br>
From: Simon Jakobi <<a href="mailto:simon.jakobi@googlemail.com" target="_blank">simon.jakobi@googlemail.com</a>><br>
To: Leonhard Applis <<a href="mailto:Leonhard.Applis@protonmail.com" target="_blank">Leonhard.Applis@protonmail.com</a>>, The<br>
Haskell-Beginners Mailing List - Discussion of primarily<br>
beginner-level topics related to Haskell <<a href="mailto:beginners@haskell.org" target="_blank">beginners@haskell.org</a>><br>
Subject: Re: [Haskell-beginners] Providing Haskell Libraries wrapped<br>
for other Languages<br>
Message-ID:<br>
<CAGtp2ShEN3HqQb2GAsPniZecStDSkqunUOz=<a href="mailto:tG7oU3TAtRXTAw@mail.gmail.com" target="_blank">tG7oU3TAtRXTAw@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="UTF-8"<br>
<br>
Hi Leonhard,<br>
<br>
I don't have any experience with calling Haskell from other languages<br>
but I am aware of this project:<br>
<br>
<a href="https://github.com/nh2/call-haskell-from-anything" rel="noreferrer" target="_blank">https://github.com/nh2/call-haskell-from-anything</a><br>
<br>
I hope it's useful to you.<br>
<br>
Cheers,<br>
Simon<br>
<br>
Am Do., 28. Nov. 2019 um 15:15 Uhr schrieb Leonhard Applis<br>
<<a href="mailto:Leonhard.Applis@protonmail.com" target="_blank">Leonhard.Applis@protonmail.com</a>>:<br>
><br>
> Hi,<br>
><br>
> I am currently writing a small library.<br>
> I will provide a small web-api for it, however I have some colleagues who neither have experience in haskell, nor in web-dev.<br>
> Also they maybe want to produce programs using my library without internet / docker / etc.<br>
><br>
> So in addition I'd like to provide the library "wrapped" for other languages, especially python, but maybe java as well.<br>
> These wrappers should do nothing except invoking their pardons on the library, and should somewhat contain the library.<br>
><br>
> What is the common way to do this?<br>
><br>
><br>
><br>
> I've seen "hyphen" as a super heavyweight solution, and I've seen people starting the haskell library listening on system-pipes.<br>
> I don't feel that these are the "best" solutions, atleast for my intention.<br>
><br>
> best regards<br>
> Leonhard<br>
> _______________________________________________<br>
> Beginners mailing list<br>
> <a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Fri, 29 Nov 2019 10:55:35 +0000<br>
From: PICCA Frederic-Emmanuel<br>
<<a href="mailto:frederic-emmanuel.picca@synchrotron-soleil.fr" target="_blank">frederic-emmanuel.picca@synchrotron-soleil.fr</a>><br>
To: "The Haskell-Beginners Mailing List - Discussion of primarily<br>
beginner-level topics related to Haskell" <<a href="mailto:beginners@haskell.org" target="_blank">beginners@haskell.org</a>><br>
Subject: [Haskell-beginners] strange error inside a case<br>
Message-ID:<br>
<<a href="mailto:A2A20EC3B8560D408356CAC2FC148E53017D83AB1A@SUN-DAG3.synchrotron-soleil.fr" target="_blank">A2A20EC3B8560D408356CAC2FC148E53017D83AB1A@SUN-DAG3.synchrotron-soleil.fr</a>><br>
<br>
Content-Type: text/plain; charset="Windows-1252"<br>
<br>
Hello, I aheve some code whcih look like this<br>
<br>
thumbnail' :: (MonadIO m, MonadReader Beamline m, MonadThrow m) => ThumbnailInput -> m ()<br>
thumbnail' (ThumbnailInput col) = do<br>
cwd <- toResultsPath "thumbnail" col<br>
let shakeFiles' = cwd </> $(mkRelDir ".shake/")<br>
let shakeReport' = shakeFiles' </> $(mkRelFile "report.html")<br>
<br>
liftIO $ shake shakeOptions{ shakeFiles=fromAbsDir shakeFiles'<br>
, shakeReport=[fromAbsFile shakeReport']<br>
, shakeVerbosity=Diagnostic<br>
} $ do<br>
let uploaded = fromAbsFile $ cwd </> $(mkRelFile "thumbnail.uploaded")<br>
<br>
want [uploaded]<br>
<br>
-- (Rule 1) merge the image files<br>
uploaded %> \_out -> do<br>
-- need [xml]<br>
masters <- liftIO $ expectedInputFiles col<br>
liftIO $ hdf2mergedcbf' (head masters) 1 1 <br>
liftIO $ case col of<br>
(SomeDataCollection SCollect SHdf5 _) -> hdf2mergedcbf' (head masters) 1 1<br>
(SomeDataCollection SCollect SHdf5' _) -> undefined -- hdf2mergedcbf' (head masters) 1 1<br>
(SomeDataCollection SCaracterization SHdf5 _) -> undefined<br>
(SomeDataCollection SCaracterization SHdf5' _) -> undefined<br>
_ -> error "show not arrive here !!!"<br>
<br>
-- hdf2mergedcbf<br>
-- command [] "touch" [uploaded]<br>
return ()<br>
<br>
<br>
When I try to compile it, it give me this error<br>
<br>
• Couldn't match type ‘a0’ with ‘()’<br>
‘a0’ is untouchable<br>
inside the constraints: f ~ 'ISPyB.DataCollection.Hdf5<br>
bound by a pattern with constructor:<br>
SHdf5 :: SCollectSourceFormat 'ISPyB.DataCollection.Hdf5,<br>
in a case alternative<br>
at src/Thumbnail.hs:180:38-42<br>
Expected type: IO a0<br>
Actual type: IO ()<br>
• In the expression: hdf2mergedcbf' (head masters) 1 1<br>
In a case alternative:<br>
(SomeDataCollection SCollect SHdf5 _)<br>
-> hdf2mergedcbf' (head masters) 1 1<br>
In the second argument of ‘($)’, namely<br>
‘case col of<br>
(SomeDataCollection SCollect SHdf5 _)<br>
-> hdf2mergedcbf' (head masters) 1 1<br>
(SomeDataCollection SCollect SHdf5' _) -> undefined<br>
(SomeDataCollection SCaracterization SHdf5 _) -> undefined<br>
(SomeDataCollection SCaracterization SHdf5' _) -> undefined<br>
_ -> error "show not arrive here !!!"’<br>
|<br>
180 | (SomeDataCollection SCollect SHdf5 _) -> hdf2mergedcbf' (head masters) 1 1<br>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
<br>
<br>
What I do not understand is how to fix this since it seems that<br>
<br>
liftIO $ hdf2mergedcbf' (head masters) 1 1 works out of the case<br>
<br>
thanks for your help<br>
<br>
Frederic<br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Fri, 29 Nov 2019 12:29:23 +0100<br>
From: Sylvain Henry <<a href="mailto:sylvain@haskus.fr" target="_blank">sylvain@haskus.fr</a>><br>
To: <<a href="mailto:beginners@haskell.org" target="_blank">beginners@haskell.org</a>><br>
Subject: Re: [Haskell-beginners] strange error inside a case<br>
Message-ID: <<a href="mailto:7c062774-ff78-569a-fba5-543eccf7cecd@haskus.fr" target="_blank">7c062774-ff78-569a-fba5-543eccf7cecd@haskus.fr</a>><br>
Content-Type: text/plain; charset="utf-8"; format=flowed<br>
<br>
Hello,<br>
<br>
What is the type of hdf2mergedcbf' ?<br>
<br>
Does it work if you write `void (hdf2mergedcbf' (head masters) 1 1)` ?<br>
<br>
<br>
On 29/11/2019 11:55, PICCA Frederic-Emmanuel wrote:<br>
> Hello, I aheve some code whcih look like this<br>
><br>
> thumbnail' :: (MonadIO m, MonadReader Beamline m, MonadThrow m) => ThumbnailInput -> m ()<br>
> thumbnail' (ThumbnailInput col) = do<br>
> cwd <- toResultsPath "thumbnail" col<br>
> let shakeFiles' = cwd </> $(mkRelDir ".shake/")<br>
> let shakeReport' = shakeFiles' </> $(mkRelFile "report.html")<br>
><br>
> liftIO $ shake shakeOptions{ shakeFiles=fromAbsDir shakeFiles'<br>
> , shakeReport=[fromAbsFile shakeReport']<br>
> , shakeVerbosity=Diagnostic<br>
> } $ do<br>
> let uploaded = fromAbsFile $ cwd </> $(mkRelFile "thumbnail.uploaded")<br>
><br>
> want [uploaded]<br>
><br>
> -- (Rule 1) merge the image files<br>
> uploaded %> \_out -> do<br>
> -- need [xml]<br>
> masters <- liftIO $ expectedInputFiles col<br>
> liftIO $ hdf2mergedcbf' (head masters) 1 1<br>
> liftIO $ case col of<br>
> (SomeDataCollection SCollect SHdf5 _) -> hdf2mergedcbf' (head masters) 1 1<br>
> (SomeDataCollection SCollect SHdf5' _) -> undefined -- hdf2mergedcbf' (head masters) 1 1<br>
> (SomeDataCollection SCaracterization SHdf5 _) -> undefined<br>
> (SomeDataCollection SCaracterization SHdf5' _) -> undefined<br>
> _ -> error "show not arrive here !!!"<br>
><br>
> -- hdf2mergedcbf<br>
> -- command [] "touch" [uploaded]<br>
> return ()<br>
><br>
><br>
> When I try to compile it, it give me this error<br>
><br>
> • Couldn't match type ‘a0’ with ‘()’<br>
> ‘a0’ is untouchable<br>
> inside the constraints: f ~ 'ISPyB.DataCollection.Hdf5<br>
> bound by a pattern with constructor:<br>
> SHdf5 :: SCollectSourceFormat 'ISPyB.DataCollection.Hdf5,<br>
> in a case alternative<br>
> at src/Thumbnail.hs:180:38-42<br>
> Expected type: IO a0<br>
> Actual type: IO ()<br>
> • In the expression: hdf2mergedcbf' (head masters) 1 1<br>
> In a case alternative:<br>
> (SomeDataCollection SCollect SHdf5 _)<br>
> -> hdf2mergedcbf' (head masters) 1 1<br>
> In the second argument of ‘($)’, namely<br>
> ‘case col of<br>
> (SomeDataCollection SCollect SHdf5 _)<br>
> -> hdf2mergedcbf' (head masters) 1 1<br>
> (SomeDataCollection SCollect SHdf5' _) -> undefined<br>
> (SomeDataCollection SCaracterization SHdf5 _) -> undefined<br>
> (SomeDataCollection SCaracterization SHdf5' _) -> undefined<br>
> _ -> error "show not arrive here !!!"’<br>
> |<br>
> 180 | (SomeDataCollection SCollect SHdf5 _) -> hdf2mergedcbf' (head masters) 1 1<br>
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
><br>
><br>
> What I do not understand is how to fix this since it seems that<br>
><br>
> liftIO $ hdf2mergedcbf' (head masters) 1 1 works out of the case<br>
><br>
> thanks for your help<br>
><br>
> Frederic<br>
> _______________________________________________<br>
> Beginners mailing list<br>
> <a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br>
<br>
------------------------------<br>
<br>
End of Beginners Digest, Vol 137, Issue 13<br>
******************************************<br>
</blockquote></div></div>