Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Providing Haskell Libraries wrapped for      other Languages
      (鲍凯文)


----------------------------------------------------------------------

Message: 1
Date: Fri, 29 Nov 2019 07:11:55 -0800
From: 鲍凯文 <traqueofzi...@gmail.com>
To: beginners@haskell.org
Subject: Re: [Haskell-beginners] Providing Haskell Libraries wrapped
        for     other Languages
Message-ID:
        <camjcg+e8zp1wrrpdcxm4urtfv21kw5_4n03nw9gettztgf2...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi,

Have you looked into Apache thrift (
https://thrift.apache.org
)? 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.

Good luck

On Fri, Nov 29, 2019 at 5:00 AM <beginners-requ...@haskell.org> wrote:

> Send Beginners mailing list submissions to
>         beginners@haskell.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> or, via email, send a message with subject or body 'help' to
>         beginners-requ...@haskell.org
>
> You can reach the person managing the list at
>         beginners-ow...@haskell.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Beginners digest..."
>
>
> Today's Topics:
>
>    1.  Providing Haskell Libraries wrapped for other    Languages
>       (Leonhard Applis)
>    2. Re:  Providing Haskell Libraries wrapped for      other Languages
>       (Simon Jakobi)
>    3.  strange error inside a case (PICCA Frederic-Emmanuel)
>    4. Re:  strange error inside a case (Sylvain Henry)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 28 Nov 2019 14:15:27 +0000
> From: Leonhard Applis <leonhard.app...@protonmail.com>
> To: "beginners@haskell.org" <beginners@haskell.org>
> Subject: [Haskell-beginners] Providing Haskell Libraries wrapped for
>         other   Languages
> Message-ID:
>
> <GWMEmGPietL5BGMOXNm_vOI1zYWXem1x6GOctodu3ftdJVurBPz36E5Jjq_lzGz7XC4t1CNeY-XajQCrh0j4NKVFXBTTGG4pBmJL6bh4U4s=@
> protonmail.com>
>
> Content-Type: text/plain; charset="utf-8"
>
> Hi,
> 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.
> Also they maybe want to produce programs using my library without internet
> / docker / etc.
>
> So in addition I'd like to provide the library "wrapped" for other
> languages, especially python, but maybe java as well.
> These wrappers should do nothing except invoking their pardons on the
> library, and should somewhat contain the library.
>
> What is the common way to do this?
> I've seen "hyphen" as a super heavyweight solution, and I've seen people
> starting the haskell library listening on system-pipes.
> I don't feel that these are the "best" solutions, atleast for my
> intention.
>
> best regards
> Leonhard
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.haskell.org/pipermail/beginners/attachments/20191128/38f52f24/attachment-0001.html
> >
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: publickey - leonhard.app...@protonmail.com - 0x807FDDF3.asc
> Type: application/pgp-keys
> Size: 1843 bytes
> Desc: not available
> URL: <
> http://mail.haskell.org/pipermail/beginners/attachments/20191128/38f52f24/attachment-0001.key
> >
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: signature.asc
> Type: application/pgp-signature
> Size: 477 bytes
> Desc: OpenPGP digital signature
> URL: <
> http://mail.haskell.org/pipermail/beginners/attachments/20191128/38f52f24/attachment-0001.sig
> >
>
> ------------------------------
>
> Message: 2
> Date: Thu, 28 Nov 2019 16:43:30 +0100
> From: Simon Jakobi <simon.jak...@googlemail.com>
> To: Leonhard Applis <leonhard.app...@protonmail.com>,  The
>         Haskell-Beginners Mailing List - Discussion of primarily
>         beginner-level topics related to Haskell <beginners@haskell.org>
> Subject: Re: [Haskell-beginners] Providing Haskell Libraries wrapped
>         for     other Languages
> Message-ID:
>         <CAGtp2ShEN3HqQb2GAsPniZecStDSkqunUOz=
> tg7ou3tatrx...@mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
>
> Hi Leonhard,
>
> I don't have any experience with calling Haskell from other languages
> but I am aware of this project:
>
> https://github.com/nh2/call-haskell-from-anything
>
> I hope it's useful to you.
>
> Cheers,
> Simon
>
> Am Do., 28. Nov. 2019 um 15:15 Uhr schrieb Leonhard Applis
> <leonhard.app...@protonmail.com>:
> >
> > Hi,
> >
> > 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.
> > Also they maybe want to produce programs using my library without
> internet / docker / etc.
> >
> > So in addition I'd like to provide the library "wrapped" for other
> languages, especially python, but maybe java as well.
> > These wrappers should do nothing except invoking their pardons on the
> library, and should somewhat contain the library.
> >
> > What is the common way to do this?
> >
> >
> >
> > I've seen "hyphen" as a super heavyweight solution, and I've seen people
> starting the haskell library listening on system-pipes.
> > I don't feel that these are the "best" solutions, atleast for my
> intention.
> >
> > best regards
> > Leonhard
> > _______________________________________________
> > Beginners mailing list
> > Beginners@haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
> ------------------------------
>
> Message: 3
> Date: Fri, 29 Nov 2019 10:55:35 +0000
> From: PICCA Frederic-Emmanuel
>         <frederic-emmanuel.pi...@synchrotron-soleil.fr>
> To: "The Haskell-Beginners Mailing List - Discussion of primarily
>         beginner-level topics related to Haskell" <beginners@haskell.org>
> Subject: [Haskell-beginners] strange error inside a case
> Message-ID:
>         <
> a2a20ec3b8560d408356cac2fc148e53017d83a...@sun-dag3.synchrotron-soleil.fr>
>
> Content-Type: text/plain; charset="Windows-1252"
>
> Hello, I aheve some code whcih look like this
>
> thumbnail' :: (MonadIO m, MonadReader Beamline m, MonadThrow m) =>
> ThumbnailInput -> m ()
> thumbnail' (ThumbnailInput col) = do
>   cwd <- toResultsPath "thumbnail" col
>   let shakeFiles' =  cwd </> $(mkRelDir ".shake/")
>   let shakeReport' = shakeFiles' </> $(mkRelFile "report.html")
>
>   liftIO $ shake shakeOptions{ shakeFiles=fromAbsDir shakeFiles'
>                              , shakeReport=[fromAbsFile shakeReport']
>                              , shakeVerbosity=Diagnostic
>                              } $ do
>     let uploaded = fromAbsFile $ cwd </> $(mkRelFile "thumbnail.uploaded")
>
>     want [uploaded]
>
>     -- (Rule 1) merge the image files
>     uploaded %> \_out -> do
>       -- need [xml]
>       masters <- liftIO $ expectedInputFiles col
>       liftIO $ hdf2mergedcbf' (head masters) 1 1
>       liftIO $ case col of
>         (SomeDataCollection SCollect SHdf5 _)          -> hdf2mergedcbf'
> (head masters) 1 1
>         (SomeDataCollection SCollect SHdf5' _)         -> undefined --
> hdf2mergedcbf' (head masters) 1 1
>         (SomeDataCollection SCaracterization SHdf5 _)  -> undefined
>         (SomeDataCollection SCaracterization SHdf5' _) -> undefined
>         _                                              -> error "show not
> arrive here !!!"
>
>       -- hdf2mergedcbf
>       -- command [] "touch" [uploaded]
>       return ()
>
>
> When I try to compile it, it give me this error
>
>     • Couldn't match type ‘a0’ with ‘()’
>         ‘a0’ is untouchable
>           inside the constraints: f ~ 'ISPyB.DataCollection.Hdf5
>           bound by a pattern with constructor:
>                      SHdf5 :: SCollectSourceFormat
> 'ISPyB.DataCollection.Hdf5,
>                    in a case alternative
>           at src/Thumbnail.hs:180:38-42
>       Expected type: IO a0
>         Actual type: IO ()
>     • In the expression: hdf2mergedcbf' (head masters) 1 1
>       In a case alternative:
>           (SomeDataCollection SCollect SHdf5 _)
>             -> hdf2mergedcbf' (head masters) 1 1
>       In the second argument of ‘($)’, namely
>         ‘case col of
>            (SomeDataCollection SCollect SHdf5 _)
>              -> hdf2mergedcbf' (head masters) 1 1
>            (SomeDataCollection SCollect SHdf5' _) -> undefined
>            (SomeDataCollection SCaracterization SHdf5 _) -> undefined
>            (SomeDataCollection SCaracterization SHdf5' _) -> undefined
>            _ -> error "show not arrive here !!!"’
>     |
> 180 |         (SomeDataCollection SCollect SHdf5 _)          ->
> hdf2mergedcbf' (head masters) 1 1
>     |
>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>
> What I do not understand is how to fix this since it seems that
>
>   liftIO $ hdf2mergedcbf' (head masters) 1 1  works out of the case
>
> thanks for your help
>
> Frederic
>
> ------------------------------
>
> Message: 4
> Date: Fri, 29 Nov 2019 12:29:23 +0100
> From: Sylvain Henry <sylv...@haskus.fr>
> To: <beginners@haskell.org>
> Subject: Re: [Haskell-beginners] strange error inside a case
> Message-ID: <7c062774-ff78-569a-fba5-543eccf7c...@haskus.fr>
> Content-Type: text/plain; charset="utf-8"; format=flowed
>
> Hello,
>
> What is the type of hdf2mergedcbf' ?
>
> Does it work if you write `void (hdf2mergedcbf' (head masters) 1 1)` ?
>
>
> On 29/11/2019 11:55, PICCA Frederic-Emmanuel wrote:
> > Hello, I aheve some code whcih look like this
> >
> > thumbnail' :: (MonadIO m, MonadReader Beamline m, MonadThrow m) =>
> ThumbnailInput -> m ()
> > thumbnail' (ThumbnailInput col) = do
> >    cwd <- toResultsPath "thumbnail" col
> >    let shakeFiles' =  cwd </> $(mkRelDir ".shake/")
> >    let shakeReport' = shakeFiles' </> $(mkRelFile "report.html")
> >
> >    liftIO $ shake shakeOptions{ shakeFiles=fromAbsDir shakeFiles'
> >                               , shakeReport=[fromAbsFile shakeReport']
> >                               , shakeVerbosity=Diagnostic
> >                               } $ do
> >      let uploaded = fromAbsFile $ cwd </> $(mkRelFile
> "thumbnail.uploaded")
> >
> >      want [uploaded]
> >
> >      -- (Rule 1) merge the image files
> >      uploaded %> \_out -> do
> >        -- need [xml]
> >        masters <- liftIO $ expectedInputFiles col
> >        liftIO $ hdf2mergedcbf' (head masters) 1 1
> >        liftIO $ case col of
> >          (SomeDataCollection SCollect SHdf5 _)          ->
> hdf2mergedcbf' (head masters) 1 1
> >          (SomeDataCollection SCollect SHdf5' _)         -> undefined --
> hdf2mergedcbf' (head masters) 1 1
> >          (SomeDataCollection SCaracterization SHdf5 _)  -> undefined
> >          (SomeDataCollection SCaracterization SHdf5' _) -> undefined
> >          _                                              -> error "show
> not arrive here !!!"
> >
> >        -- hdf2mergedcbf
> >        -- command [] "touch" [uploaded]
> >        return ()
> >
> >
> > When I try to compile it, it give me this error
> >
> >      • Couldn't match type ‘a0’ with ‘()’
> >          ‘a0’ is untouchable
> >            inside the constraints: f ~ 'ISPyB.DataCollection.Hdf5
> >            bound by a pattern with constructor:
> >                       SHdf5 :: SCollectSourceFormat
> 'ISPyB.DataCollection.Hdf5,
> >                     in a case alternative
> >            at src/Thumbnail.hs:180:38-42
> >        Expected type: IO a0
> >          Actual type: IO ()
> >      • In the expression: hdf2mergedcbf' (head masters) 1 1
> >        In a case alternative:
> >            (SomeDataCollection SCollect SHdf5 _)
> >              -> hdf2mergedcbf' (head masters) 1 1
> >        In the second argument of ‘($)’, namely
> >          ‘case col of
> >             (SomeDataCollection SCollect SHdf5 _)
> >               -> hdf2mergedcbf' (head masters) 1 1
> >             (SomeDataCollection SCollect SHdf5' _) -> undefined
> >             (SomeDataCollection SCaracterization SHdf5 _) -> undefined
> >             (SomeDataCollection SCaracterization SHdf5' _) -> undefined
> >             _ -> error "show not arrive here !!!"’
> >      |
> > 180 |         (SomeDataCollection SCollect SHdf5 _)          ->
> hdf2mergedcbf' (head masters) 1 1
> >      |
>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >
> >
> > What I do not understand is how to fix this since it seems that
> >
> >    liftIO $ hdf2mergedcbf' (head masters) 1 1  works out of the case
> >
> > thanks for your help
> >
> > Frederic
> > _______________________________________________
> > Beginners mailing list
> > Beginners@haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
> ------------------------------
>
> End of Beginners Digest, Vol 137, Issue 13
> ******************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20191129/7a91214c/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 137, Issue 14
******************************************

Reply via email to