From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 2P6wJyJs0l93GQAA0tVLHw (envelope-from ) for ; Thu, 10 Dec 2020 18:42:42 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id gASFIyJs0l8+TwAAB5/wlQ (envelope-from ) for ; Thu, 10 Dec 2020 18:42:42 +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 10BFF9403AC for ; Thu, 10 Dec 2020 18:42:41 +0000 (UTC) Received: from localhost ([::1]:42246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knQtj-0005zn-Vs for larch@yhetil.org; Thu, 10 Dec 2020 13:42:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knQrr-0005wb-CR for emacs-orgmode@gnu.org; Thu, 10 Dec 2020 13:40:43 -0500 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]:42593) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1knQrn-0003sp-CI for emacs-orgmode@gnu.org; Thu, 10 Dec 2020 13:40:43 -0500 Received: by mail-io1-xd2f.google.com with SMTP id q137so6581210iod.9 for ; Thu, 10 Dec 2020 10:40:38 -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:content-transfer-encoding; bh=2PtuMxMQ7U1VFjsJeQeatPQPB5orI3VIb3lzhWMMfyA=; b=jnOj+1zlo5BxP3luPiJsoVwhfYVxyRN8Epeqh+wNW88U+Gye8d8EoplshefsgCQRJ4 NrPHcmCmwAsFSsNWaHCn6hK6BJ7TMWM4UOPDzCmn6APbhextn/WFRuLTkl5Snl8yBAgc J9maiFA8w17H1/OsOYqOjHLNloKnWhce7H4yUTm1d0/o47TyN8/kc1JFF9z3PcflJOFP +4XjOo8NRG8bHdlgYPoz2lz8TlPCPnL8RGdhbqD/OQI14uXTRvU+icYKrCWJJo4AUiv3 QILdqNnEdqCBdadJ1ETSAbVw2pInry6TlgWU2i9KP5fublHnMVWni6Ijt7NQ3pd3EfEj WaiA== 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:content-transfer-encoding; bh=2PtuMxMQ7U1VFjsJeQeatPQPB5orI3VIb3lzhWMMfyA=; b=hpbu7SUU1VWY1iTE344Xx0kgjVYuPlgUFV0zI38ITGrOmVPOWc+Xq/qo4QAQ2LQE2r 2I11s+Z/WiYD5swC1/epY035+ip8kYZJGWsKmaOBnt/RdMvz/bTwZBNeeHbZKAMHPoZt cWbNMmbufASdlWc7BM94+OZoYlMleVZYe9VtOjfdZYpigyiHyu7UxvgWc6WjCXo05Iih nGV8P4FzBt5mWUkZSrPsq6tNUmMgSa53QddyHNTqcJLC0s+tL6BGsjyg0gI5ANpQhXS+ UNkWKg21iQ7z19YrMVYEyXgZTaQfbbGhqEpBPw9rNADF8yZtwfCh+HsH2pnjOevfZcmf YGrQ== X-Gm-Message-State: AOAM531l4BP//lpfWQkN1dKCwA6s4r12GnIY6daUVmA+ln5AaijZyv5+ obJz9Ugrm2pW2Jhp9QYPa+tYHtBk4R9i7ex5TQ== X-Google-Smtp-Source: ABdhPJxmTGzJPjCaD6z38U3WrJV1/ga8NtsCB31dofVZTMIf2QjzbRbYtUols7LW2orw0J89W6uMK7fi+JxwXV0Q2a8= X-Received: by 2002:a02:6557:: with SMTP id u84mr9982998jab.82.1607625638112; Thu, 10 Dec 2020 10:40:38 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Immanuel Litzroth Date: Thu, 10 Dec 2020 19:40:02 +0100 Message-ID: Subject: Re: Unhealthy Haskell babel To: Lawrence Bottorff Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::d2f; envelope-from=immanuel.litzroth@gmail.com; helo=mail-io1-xd2f.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, 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=jnOj+1zl; 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: 10BFF9403AC X-Spam-Score: -3.00 X-Migadu-Scanner: scn1.migadu.com X-TUID: EDfeCyxMwSqP 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 mean= t for the REPL-dominant world of org-mode babel. Babel's sweet-spot would b= e 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 RE= PL issue. I'm just a beginner with Haskell, and all my intro texts start yo= u 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 t= o 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 deci= sion 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 t= o see your tangle option, please. > > On Thu, Dec 10, 2020 at 4:28 AM Immanuel Litzroth 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 wr= ote: >> > >> > 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 o= f =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 o= f =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. Obviousl= y, Haskell is not ready to be used with Babel. Can it be fixed? BTW, this d= oes 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. --=20 -- Researching the dual problem of finding the function that has a given point as fixpoint.