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 cFUdMf6E0l/kCgAA0tVLHw (envelope-from ) for ; Thu, 10 Dec 2020 20:28:46 +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 yD7qLP6E0l/uQQAA1q6Kng (envelope-from ) for ; Thu, 10 Dec 2020 20:28:46 +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 3613C9402A8 for ; Thu, 10 Dec 2020 20:28:46 +0000 (UTC) Received: from localhost ([::1]:43178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knSYP-0007Rg-6w for larch@yhetil.org; Thu, 10 Dec 2020 15:28:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knSWi-0006zz-Fg for emacs-orgmode@gnu.org; Thu, 10 Dec 2020 15:27:02 -0500 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]:46064) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1knSWZ-0005cz-VJ for emacs-orgmode@gnu.org; Thu, 10 Dec 2020 15:27:00 -0500 Received: by mail-ej1-x633.google.com with SMTP id qw4so9160622ejb.12 for ; Thu, 10 Dec 2020 12:26:51 -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=V03ZnN3PWHyPpds5uBaqXRmfk9dArvLbLHJwNJEMJow=; b=bmRX/h0bgtA5rGG2+Yr2UETeUYLY0j80dieN6n8WbjP24hWtEyMZg631UiSYcAAUVR PGRtYm6zeriPdzFZv9NupMowqACjll6FXYsBoauGRiET9nwQ2/XsZn2V05I/TbPISVON +ywIqCPodBNpie2LWNEAzrpxbEW80dMXKo/i5S2hHYMIRfEoZpB6IjLZMEFY2nxAmc0q FUlcxFHa42vXiB4JPg3R6LiB3lDtyO9e/HBpU8C84KaSGdrmIEYCy5UsG8twLn4xyjUn CWyfmm3pOtqtzQ7E2LPiVn0s0IFhBlTRPcwCGJqCd6Id3JVpg9b80atf6jYjCmR7SUb4 Gamg== 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=V03ZnN3PWHyPpds5uBaqXRmfk9dArvLbLHJwNJEMJow=; b=G2SvSgzI+8d08rYkz698x4+9IFneLBLqSPINL9LLCbBKoOlmUy1ppvrOb/GzosW4ro LlSvPi1oN0E7ucBOKR9i/GtZfCN455B0aeE7n0A/QRlClxKA7rv+bQNw3czjLXLOrMpI sxwsk5CD5HmAwWAPaSNmZFTOfB6JLQmYjW10j5Crn5fasbn/q5CkNxvHoHfVcbPOf4nu jLL7EQugHNoD5cEXCJLPi8GtnbV2H+pk7acIs7Gmr35zaGrF3yJhLoLSbQ3cBobG1ac8 rTqr4P/I9iJecoL8kv4Z3vvy3R9hUuTFLPuWYaf8cplhn49K0bBfif8qbg5nZj0DIgGp IpmQ== X-Gm-Message-State: AOAM533UZLiKu7RRkYh/ozhPlkn+sx2Rk8706RsIeOHjCtnq/Mi6hpXx tt+t0q7NGwB9256WrNnFpe/gYSKkfEnsUa4vnHc= X-Google-Smtp-Source: ABdhPJzx64JDm/8Felw9drWIWg82FdKYg4RCsy2+FUP04pFYHGPRtJ1ZHkAqL7jgsPnqueqDTPBHDUkMNFTL5AkPiXk= X-Received: by 2002:a17:906:b2d1:: with SMTP id cf17mr8279324ejb.281.1607632010143; Thu, 10 Dec 2020 12:26:50 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Lawrence Bottorff Date: Thu, 10 Dec 2020 14:26:36 -0600 Message-ID: Subject: Re: Unhealthy Haskell babel To: Immanuel Litzroth Content-Type: multipart/alternative; boundary="000000000000e4ed8105b621febb" Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=borgauf@gmail.com; helo=mail-ej1-x633.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, 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=bmRX/h0b; 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: 3613C9402A8 X-Spam-Score: -3.00 X-Migadu-Scanner: scn1.migadu.com X-TUID: OVRL+7zH+tOT --000000000000e4ed8105b621febb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Yes -- and I think I came across this long ago during another attempt and totally forgot about it. I think I'll write this up on emacs.stackexchange so others will not have to scrounge around. I'm pursuing this because I really believe emacs org-mode "reproducible research" is superior to all other methods so far. On Thu, Dec 10, 2020 at 12:40 PM Immanuel Litzroth < immanuel.litzroth@gmail.com> wrote: > Well another possible solution is to wrap the code blocks in > :{ > xxx > :} > in > (defun org-babel-execute:haskell (body params) -- ob-haskell.el > Immanuel > > On Thu, Dec 10, 2020 at 6:21 PM Lawrence Bottorff > wrote: > > > > 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 worke= d > 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 swit= ch > 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 REP= L > 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 does work with the regular ghci REPL and haskell-mode. If it > helps, Standard 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. > > > > -- > -- Researching the dual problem of finding the function that has a > given point as fixpoint. > --000000000000e4ed8105b621febb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Yes -- and I think I came across this long ago during anot= her attempt and totally forgot about it. I think I'll write this up on = emacs.stackexchange so others will not have to scrounge around. I'm pur= suing this because I really believe emacs org-mode "reproducible resea= rch" is superior to all other methods so far.

On Thu, Dec 10, 2020 at 1= 2:40 PM Immanuel Litzroth <immanuel.litzroth@gmail.com> wrote:
Well another possible solution is to wrap the = code blocks in
:{
xxx
:}
in
(defun org-babel-execute:haskell (body params) -- ob-haskell.el
Immanuel

On Thu, Dec 10, 2020 at 6:21 PM Lawrence Bottorff <borgauf@gmail.com> wrote:
>
> I see your point, i.e., compiled, multi-file projects are not really m= eant 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. Sti= ll, the ability to add code to a running REPL should be possible. As I ment= ioned, 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 Has= kell REPL issue. I'm just a beginner with Haskell, and all my intro tex= ts start you out using the ghci REPL interactively. But then they switch yo= u over to a text file compiled in the REPL with :l myfile.hs . . . no expla= nation as to why you can't just continue with the REPL putting the prog= ram in line-by-line. The fact that I can use the :set +m to include multipl= e 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 interesti= ng. Yes, I'd like to see your tangle option, please.
>
> On Thu, Dec 10, 2020 at 4:28 AM Immanuel Litzroth <immanuel.litzroth@gmail.co= m> 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 wh= ole 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 wil= l
>> 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 w= hole. 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)) arising from a use of =E2=80=98print=E2=80=99
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(maybe you haven't appli= ed a function 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-e= oe"
>> >
>> > 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)) arising from a use of =E2=80=98print=E2=80=99
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(maybe you haven't appli= ed a function 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 h= ere. Obviously, Haskell is not ready to be used with Babel. Can it be fixed= ? BTW, this does work with the regular ghci REPL and haskell-mode. If it he= lps, Standard ML, which has very similar syntax (it was Haskell's paren= t), works fine.
>> >
>> > LB
>>
>>
>>
>> --
>> -- Researching the dual problem of finding the function that has a=
>> given point as fixpoint.



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