From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 2nbXNYlc0l9DfgAA0tVLHw (envelope-from ) for ; Thu, 10 Dec 2020 17:36:09 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id SBM3MYlc0l8jSAAA1q6Kng (envelope-from ) for ; Thu, 10 Dec 2020 17:36:09 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 32501940482 for ; Thu, 10 Dec 2020 17:36:09 +0000 (UTC) Received: from localhost ([::1]:44968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knPrK-0004FK-QH for larch@yhetil.org; Thu, 10 Dec 2020 12:36:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knPd8-000536-Ga for emacs-orgmode@gnu.org; Thu, 10 Dec 2020 12:21:26 -0500 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]:46531) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1knPd4-0002ti-84 for emacs-orgmode@gnu.org; Thu, 10 Dec 2020 12:21:26 -0500 Received: by mail-ed1-x52c.google.com with SMTP id b73so6333945edf.13 for ; Thu, 10 Dec 2020 09:21:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XT+objLsM/o30CpVfhPQ/O+QOq/TBr5vXPFMQPn2sAI=; b=SAmRjFH8CM38bNK5coXEQhDM2SSUTG8xfrY3h6CnM/N2BMoQ9wlrBKWbsnJoVRwq9H FfuLHPQxKDP0AH2TPMaIeEZ/rdMPlw3FR1/4MpYKLPJaYtpbURBqgN7gEnHUEa1Zwbo6 oiMEFbho1fiBABCye5WvlMfWwbft306EwQP94HsMaH6lji0xwsL0VIQuS2SPR4QStJ4A 8ro979H8I8S1p6Lz1HegWwD+vrJatj5Ddv7EojMVAZor5ZuXZYR20//0PrReEJ0agjPN LqmZxCLKD5IFBXaT4niQwupJ/oRNe4m2Bi7x1iGkC5YKqx17eeJs00H4BfpbeSb+c1OO 07ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XT+objLsM/o30CpVfhPQ/O+QOq/TBr5vXPFMQPn2sAI=; b=iiLuXVClt/b0+ELk20qoYvkvOmqmyKuNZRnbNORVwt8Hw2Rjv5j2vItkDDovZuHz72 liyS7YuWd3L7tEKyjjzEeyNdVnZfRfjqQ2ybpUAy980YwZljUb83XpMm3koZ2rELY/D2 mjPAqTWEXRs9CTpxCqcQ4uDzi01AehdFJk4JjwbHGRDo0ardoZ3zTvCyNTvfUCactvma ZZBvX9GnY2udW0PN70Sz8LNSATM2M76H/m9SrmFOgaPfsnsjFh3TQMAIC8sDWHU39cAq XQZyCY0VN9qH/zRepSGFKDgUOSKesjmDuWS8cDEjN1WUcect5Tn2IF/jMJd8dGFYoS2K +G4w== X-Gm-Message-State: AOAM530zZvk6v4r7egUM72xIxmUE3Mi3hn6GYlYps1kAQNRun8sucEQe s1zaWKxS1lQokvp0IuLAQS2XjSKqCkkuWjZu1r66TOcdXQ0= X-Google-Smtp-Source: ABdhPJxjIarN7Kb+GTKNv9aEsAHsQALQuRqnAcCJxTGasVcnEAoEO8OZEWnyAk3Lne3x9HlBdpyXAeKwzRFxPJr/dsM= X-Received: by 2002:a50:bf4a:: with SMTP id g10mr7696971edk.201.1607620880094; Thu, 10 Dec 2020 09:21:20 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Lawrence Bottorff Date: Thu, 10 Dec 2020 11:21:07 -0600 Message-ID: Subject: Re: Unhealthy Haskell babel To: Immanuel Litzroth Content-Type: multipart/alternative; boundary="0000000000007dd71605b61f6787" Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=borgauf@gmail.com; helo=mail-ed1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode Mailinglist Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.00 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=SAmRjFH8; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 32501940482 X-Spam-Score: -3.00 X-Migadu-Scanner: scn1.migadu.com X-TUID: UPeIqFzAWFCv --0000000000007dd71605b61f6787 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I see your point, i.e., compiled, multi-file projects are not really meant for the REPL-dominant world of org-mode babel. Babel's sweet-spot would be the interpreted world, the very best probably a Lisp language. Still, the ability to add code to a running REPL should be possible. As I mentioned, SML is a sibling of Haskell and its babel implementation worked fine for me as I worked through an SML course. So yes, this appears to be a Haskell REPL issue. I'm just a beginner with Haskell, and all my intro texts start you out using the ghci REPL interactively. But then they switch you over to a text file compiled in the REPL with :l myfile.hs . . . no explanation as to why you can't just continue with the REPL putting the program in line-by-line. The fact that I can use the :set +m to include multiple lines of code, but cannot do a type definition is rather bizarre, though. This is a decision Haskell made with their REPL and babel really can't do much about it, I suppose. The Haskell .lhs literate option is interesting. Yes, I'd like to see your tangle option, please. On Thu, Dec 10, 2020 at 4:28 AM Immanuel Litzroth < immanuel.litzroth@gmail.com> wrote: > I don't think org-babel is a good fit for compiled languages. If the > idea is to just take 1 snippet, > and "execute" that it means that to have a consistent whole you'd need > to put all the modules of > your program into that snippet (already impossible in Haskell, you can > have only 1 module per file), > compile that, run the resulting binary. Or org mode would have to have > some idea of what needs to > be retangled & rebuilt. > I think that using org-babel for compiled, multifile languages will > only work in very simple cases -- and > even then.. -- but will lead to problems very soon. > Immanuel > > On Thu, Dec 10, 2020 at 4:21 AM Lawrence Bottorff > wrote: > > > > I'm looking into Haskell (latest ghci) again on org-mode. This > > > > #+begin_src haskell :results verbatim :exports both > > :set +m > > doubleSmallNumber x =3D if x > 100 > > then x > > else x*2 > > #+end_src > > > > works, but still the :set +m is necessary for it to see the whole. But > this > > > > #+begin_src haskell :results verbatim :exports both > > :set +m > > factorial :: Int -> Int > > factorial 0 =3D 1 > > factorial n =3D n * factorial (n - 1) > > #+end_src > > > > results in this on the REPL side: > > > > Prelude> :set +m > > factorial :: Int -> Int > > factorial 0 =3D 1 > > factorial n =3D n * factorial (n - 1) > > "org-babel-haskell-eoe" > > Prelude> > > :26:1-23: error: > > =E2=80=A2 No instance for (Show (Int -> Int)) arising from a use of= =E2=80=98print=E2=80=99 > > (maybe you haven't applied a function to enough arguments?) > > =E2=80=A2 In a stmt of an interactive GHCi command: print it > > Prelude> Prelude> Prelude> "org-babel-haskell-eoe" > > > > which is the same behavior if I try to feed the program into the REPL > one line at a time, i.e., > > > > Prelude> factorial :: Int -> Int > > > > :40:1-23: error: > > =E2=80=A2 No instance for (Show (Int -> Int)) arising from a use of= =E2=80=98print=E2=80=99 > > (maybe you haven't applied a function to enough arguments?) > > =E2=80=A2 In a stmt of an interactive GHCi command: print it > > > > So the :set +m trick (take multiple lines) doesn't help here. Obviously= , > Haskell is not ready to be used with Babel. Can it be fixed? BTW, this do= es > work with the regular ghci REPL and haskell-mode. If it helps, Standard M= L, > which has very similar syntax (it was Haskell's parent), works fine. > > > > LB > > > > -- > -- Researching the dual problem of finding the function that has a > given point as fixpoint. > --0000000000007dd71605b61f6787 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I see your point, i.e., compiled, multi-file projects are = not really meant for the REPL-dominant world of org-mode babel. Babel's= sweet-spot would be the interpreted world, the very best probably a Lisp l= anguage. Still, the ability to add code to a running REPL should be possibl= e. As I mentioned, SML is a sibling of Haskell and its babel implementation= worked fine for me as I=C2=A0worked through an SML course. So yes, this ap= pears to be a Haskell REPL issue. I'm just a beginner with Haskell, and= all my intro texts start you out using the ghci REPL interactively. But th= en they switch you over to a text file compiled in the REPL with :l myfile.= hs=C2=A0. . . no explanation as to why you can't just continue with the= REPL putting the program in line-by-line. The fact that I can use the=C2= =A0:set +m to include multiple lines of code, but cannot do a type definiti= on is rather bizarre, though. This is a decision Haskell made with their RE= PL and babel really can't do much about it, I suppose. The Haskell .lhs= literate option is interesting. Yes, I'd like to see your tangle optio= n, please.

On Thu, Dec 10, 2020 at 4:28 AM Immanuel Litzroth <immanuel.litzroth@gmail.com> wro= te:
I don't = think org-babel is a good fit for compiled languages. If the
idea is to just take 1 snippet,
and "execute" that it means that to have a consistent whole you&#= 39;d need
to put all the modules of
your program into that snippet (already impossible in Haskell, you can
have only 1 module per file),
compile that, run the resulting binary. Or org mode would have to have
some idea of what needs to
be retangled & rebuilt.
I think that using org-babel for compiled, multifile languages will
only work in very simple cases -- and
even then.. -- but will lead to problems very soon.
Immanuel

On Thu, Dec 10, 2020 at 4:21 AM Lawrence Bottorff <borgauf@gmail.com> wrote:
>
> I'm looking into Haskell (latest ghci) again on org-mode. This
>
> #+begin_src haskell :results verbatim :exports both
> :set +m
> doubleSmallNumber x =3D if x > 100
>=C2=A0 =C2=A0then x
>=C2=A0 =C2=A0else x*2
> #+end_src
>
> works, but still the :set +m is necessary for it to see the whole. But= this
>
> #+begin_src haskell :results verbatim :exports both
> :set +m
> factorial :: Int -> Int
> factorial 0 =3D 1
> factorial n =3D n * factorial (n - 1)
> #+end_src
>
> results in this on the REPL side:
>
> Prelude> :set +m
> factorial :: Int -> Int
> factorial 0 =3D 1
> factorial n =3D n * factorial (n - 1)
> "org-babel-haskell-eoe"
> Prelude>
> <interactive>:26:1-23: error:
>=C2=A0 =C2=A0 =C2=A0=E2=80=A2 No instance for (Show (Int -> Int)) ar= ising from a use of =E2=80=98print=E2=80=99
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(maybe you haven't applied a func= tion to enough arguments?)
>=C2=A0 =C2=A0 =C2=A0=E2=80=A2 In a stmt of an interactive GHCi command:= print it
> Prelude> Prelude> Prelude> "org-babel-haskell-eoe"<= br> >
> which is the same behavior if I try to feed the program into the REPL = one line at a time, i.e.,
>
> Prelude> factorial :: Int -> Int
>
> <interactive>:40:1-23: error:
>=C2=A0 =C2=A0 =C2=A0=E2=80=A2 No instance for (Show (Int -> Int)) ar= ising from a use of =E2=80=98print=E2=80=99
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(maybe you haven't applied a func= tion to enough arguments?)
>=C2=A0 =C2=A0 =C2=A0=E2=80=A2 In a stmt of an interactive GHCi command:= print it
>
> So the :set +m trick (take multiple lines) doesn't help here. Obvi= ously, Haskell is not ready to be used with Babel. Can it be fixed? BTW, th= is does work with the regular ghci REPL and haskell-mode. If it helps, Stan= dard ML, which has very similar syntax (it was Haskell's parent), works= fine.
>
> LB



--
-- Researching the dual problem of finding the function that has a
given point as fixpoint.
--0000000000007dd71605b61f6787--