# Keeping Hugs alive

**URL:** <https://discourse.haskell.org/t/keeping-hugs-alive/7737>\
**Category:** Uncategorized\
**Created:** [September 30, 2023, 9:34pm UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737 "2023-09-30T21:34:37Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisdone](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/chrisdone/32/1408_2.png) [@chrisdone](https://discourse.haskell.org/u/chrisdone)\
**Post date:** [September 30, 2023, 9:34pm UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/1 "2023-09-30T21:34:37Z")

</div>

The Hugs Haskell compiler/interpreter is a unique piece of work. Unfortunately, it’s kind of hard to install or build these days. Some time last year I tried to build it and gave up due to C build system arcanea. Is there any interest in bringing it back to life with “modern” CI builds, for example?

It gives me the same “time capsule” vibes that e.g. Common Lisp implementations do. A Haskell that I could target and know that it’s not a moving target. For e.g. teaching or scripting.

The only problem is that there’s no one left to keep it alive. Some distributions have historically provided packages for it, but I’m noticing more often that it’s lagging or not published anymore.

So I’m curious whether there’s any interest from others about keeping it on life support? Also, does anyone maintain a “modernised”/patched version of it privately? I thought about taking the 2006 release or a recent working one from Debian or something, but there might be build system work done on it already.

---

<div class="post-metadata">

**Author:** ![Ambrose](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/ambrose/32/5672_2.png) [@Ambrose](https://discourse.haskell.org/u/Ambrose)\
**Post date:** [September 30, 2023, 9:41pm UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/2 "2023-09-30T21:41:43Z")

</div>

> It gives me the same “time capsule” vibes that e.g. Common Lisp implementations do.

I love that!

Having Hugs crystallized in a Nix derivation sounds quite cool. It would be a fun challenge as well 😈

Hugs will always have a special place in my heart. I first learned Haskell doing an RPi project for school. It was GHC 7.something. `ghci` didn’t work on the RPi, so I used the hugs repl. I learned a lot by using that hugs repl! Forever grateful.

---

<div class="post-metadata">

**Author:** ![atravers](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@atravers](https://discourse.haskell.org/u/atravers)\
**Post date:** [September 30, 2023, 11:00pm UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/3 "2023-09-30T23:00:19Z")

</div>

> [@chrisdone](#):
>
> Some time last year I tried to build it and gave up due to C build system arcanea.

That’s odd - for a version I grabbed from the Hugs site, the _"point of stoppage_" was that it had been updated to use Cabal during the build process: that failed, so I instead switched to one of the OS-package sources, which I was able to build (I don’t recall having to make any changes - maybe I was just fortunate: no lunar disturbances that day).

* * *

> [@Ambrose](#):
>
> Having Hugs crystallized in a Nix derivation sounds quite cool.

> [@\[ANN\] - Hugs for MacOS (x86) - via Nix Flakes](http://discourse.haskell.org/t/ann-hugs-for-macos-x86-via-nix-flakes/5171):
>
> I spent some time with the last public release of the Hugs sources, making them compile on a modern Mac (x86 chipset). I used Nix’s flakes feature to manage the build and install. If you’d like to run the hugs interpreter directly using the flake, just type: nix run github:m4dc4p/hugs#hugs If you’d like to execute a Haskell file, try: nix run github:m4dc4p/hugs \<file.hs\> Or alternately: nix run github:m4dc4p/hugs#runhugs \<file.hs\> (That is, runhugs is the default app provided by the flake…

---

<div class="post-metadata">

**Author:** ![AntC2](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/antc2/32/1872_2.png) [@AntC2](https://discourse.haskell.org/u/AntC2)\
**Post date:** [October 1, 2023, 5:19am UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/4 "2023-10-01T05:19:58Z")

</div>

> [@atravers](#):
>
> I don’t recall having to make any changes

I build on Windows using Visual Studio (an out-of-support 2013 version). But yes ran into build system/library complaints around FFI. I’m not trying to build entirely from source (nor calling FFI), so I just ported the FFI objects into the path, and they got linked ok.

[Here’s a repo](https://github.com/FranklinChen/hugs98-plus-Sep2006/tree/master/src) that made a start on trying to modernise/compile from scratch; looks like they just ran out of steam.

---

<div class="post-metadata">

**Author:** ![atravers](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@atravers](https://discourse.haskell.org/u/atravers)\
**Post date:** [October 1, 2023, 5:49am UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/5 "2023-10-01T05:49:40Z")

</div>

> [@chrisdone](#):
>
> The Hugs Haskell compiler/interpreter is a unique piece of work.

…no, _“unique”_ doesn’t quite do it justice: I consider the Hugs interpreter to be an _extraordinary_ piece of work (especially considering the choice of implementation language). Perhaps the only other codebase to even remotely approach its complexity for the given task would be the recently-released Miranda(R) implementation (same choice of implementation language).

* * *

> [@atravers](#):
>
> I don’t recall having to make any changes […]

**`>_<`** …and one crucial reason probably was that I built it on a G/Linux OS (I haven’t had a regular install of _“those other OSs”_ since the late 1990s).

* * *

> [@AntC2](#):
>
> `https://github.com/FranklinChen/hugs98-plus-Sep2006/tree/master/src`
> 
> [it] looks like they just ran out of steam.

From `https://github.com/FranklinChen/hugs98-plus-Sep2006/tree/master/README.md` :

> [@](#):
>
> I have updated the source code of the original 2006 distribution to make it build again today, on Mac OS X in particular.
> 
> I am maintaining this repo of Hugs for historical purposes.
> 
> I have not tested other platforms but would welcome verification or additional portability fixes).

…let’s ask @FranklinChen `(`if that’s his repository `:-)`

---

<div class="post-metadata">

**Author:** ![juhp](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/juhp/32/323_2.png) [@juhp](https://discourse.haskell.org/u/juhp)\
**Post date:** [October 1, 2023, 7:51am UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/6 "2023-10-01T07:51:19Z")

</div>

I like your thinking: having it maintained would be good indeed; though on Linux I think things not that bad:

[https://repology.org/project/hugs98/versions](https://repology.org/project/hugs98/versions)

---

<div class="post-metadata">

**Author:** ![zarybnicky](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/zarybnicky/32/4046_2.png) [@zarybnicky](https://discourse.haskell.org/u/zarybnicky)\
**Post date:** [October 1, 2023, 10:49am UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/7 "2023-10-01T10:49:27Z")

</div>

Perhaps I’ve missed something (I’m just passing by from the newsletter summary), but just trying out `nix shell nixpkgs#hugs -c hugs` gets me a running Hugs shell. (`nix run nixpkgs#hugs` is broken due to an irrelevant naming error.)

Looking at the [derivation](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/interpreters/hugs/default.nix), it seems to be based on the Arch PKGBUILD recipe, using one patch file from Arch and a handful of configure flags but nothing really surprising. I would hazard a guess that with a basic `build-essentials` and `bison`, you should be able to get it running with the classic `gunzip, ./configure, make, make install` incantation if you use the same configure flags.

---

<div class="post-metadata">

**Author:** ![FranklinChen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/franklinchen/32/3701_2.png) [@FranklinChen](https://discourse.haskell.org/u/FranklinChen)\
**Post date:** [October 1, 2023, 12:47pm UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/8 "2023-10-01T12:47:45Z")

</div>

I stopped trying to maintain my minimally patched original version of Hugs. I think there are others out there who have done more extensive modifications.

---

<div class="post-metadata">

**Author:** ![atravers](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@atravers](https://discourse.haskell.org/u/atravers)\
**Post date:** [October 1, 2023, 6:37pm UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/9 "2023-10-01T18:37:08Z")

</div>

…this being a small sample:

- [Hugs.js](https://jgalenson.github.io/research.js/demos/hugs.html)

- [Closure to Home: Hugs for the Nintendo DS](https://web.archive.org/web/20120313155918/https://blog.closuretohome.com/2007/12/hugs-for-nintendo-ds.html)

- [GitHub - trenttobler/android-termux-hugs: Adaption of https://github.com/conscell/hugs-android (hugs haskell interpreter) so it can be built and run using the android termux app.](https://github.com/trenttobler/android-termux-hugs)

- [FatHugs](http://www.ninebynine.org/Software/FatHugs.html)

---

<div class="post-metadata">

**Author:** ![Ambrose](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/ambrose/32/5672_2.png) [@Ambrose](https://discourse.haskell.org/u/Ambrose)\
**Post date:** [October 1, 2023, 8:01pm UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/10 "2023-10-01T20:01:37Z")

</div>

This does seem to be basically what I was thinking (I didn’t even consider it would be there!)

---

<div class="post-metadata">

**Author:** ![atravers](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@atravers](https://discourse.haskell.org/u/atravers)\
**Post date:** [May 28, 2024, 4:02am UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/11 "2024-05-28T04:02:56Z")

</div>

Give Hugs its own native-code generator so it can be used to build stand-alone whole-program binaries? It’s predecessor - Gofer - included `gofcc`, which compiled via C…

---

<div class="post-metadata">

**Author:** ![MangoIV](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/mangoiv/32/3519_2.png) [@MangoIV](https://discourse.haskell.org/u/MangoIV)\
**Post date:** [June 1, 2024, 10:49am UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/12 "2024-06-01T10:49:06Z")

</div>

It is packaged in nixpkgs, though I have not tried it out.

---

<div class="post-metadata">

**Author:** ![AntC2](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/antc2/32/1872_2.png) [@AntC2](https://discourse.haskell.org/u/AntC2)\
**Post date:** [June 1, 2024, 9:37pm UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/13 "2024-06-01T21:37:51Z")

</div>

> [@atravers](#):
>
> so it can be used to build stand-alone (executable) binaries?

Do you mean whole-program executables? Or modules (libraries) that can be linked together? If the latter, I think there’ll be difficulties with separate compilation of overlapping instances. Hugs wants to see all the instance decls (and know they are all) to do instance resolution.

---

<div class="post-metadata">

**Author:** ![atravers](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@atravers](https://discourse.haskell.org/u/atravers)\
**Post date:** [June 1, 2024, 9:53pm UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/14 "2024-06-01T21:53:07Z")

</div>

Whole programs (now updated previous post) - Hugs already deals with individual modules reasonably well, so I don’t really see a need to individually compile binaries for those (and hence _escaping_ the requirement for some lumbering version-tracking bureaucracy for binary artifacts). Moreover, since Hugs would already have the entire program in memory, it could use whole-program optimisations more easily than other implementations.

So no library binaries - only compile whole programs.

---

<div class="post-metadata">

**Author:** ![atravers](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@atravers](https://discourse.haskell.org/u/atravers)\
**Post date:** [January 24, 2025, 12:00am UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/15 "2025-01-24T00:00:18Z")

</div>

A _“bootstrap-grade”_ version of Hugs (for use with [MicroHs](https://github.com/augustss/MicroHs/tree/hugs)) is now also available:

> **[GitHub - augustss/hugs98-plus-Sep2006: Revive Hugs98 from its last official...](https://github.com/augustss/hugs98-plus-Sep2006)**
>
> Revive Hugs98 from its last official self-contained distribution.

based on Franklin Chen’s [repository](https://github.com/FranklinChen/hugs98-plus-Sep2006):

> [@](#):
>
> Hugs was a popular implementation of the Haskell programming language in the 1990s. Maintenance of it stopped in 2009, three years after the final release in 2006.
> 
> I have updated the source code of the original 2006 distribution to make it build again today, on Mac OS X in particular.
> 
> I am maintaining this repo of Hugs for historical purposes.
> 
> I have not tested other platforms but would welcome verification or additional portability fixes). I did not start with the [development version as of 2009](https://github.com/FranklinChen/Hugs) because of uncertainty about any changes introduced since 2006.
> 
> [README.md](https://github.com/FranklinChen/hugs98-plus-Sep2006/blob/master/README.md)

---

<div class="post-metadata">

**Author:** ![junjihashimoto](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/junjihashimoto/32/2726_2.png) [@junjihashimoto](https://discourse.haskell.org/u/junjihashimoto)\
**Post date:** [March 31, 2025, 7:55pm UTC](https://discourse.haskell.org/t/keeping-hugs-alive/7737/16 "2025-03-31T19:55:46Z")

</div>

I built one for educational purposes 9 years ago using emscripten with an editor and filesystem, running in a browser, and it still works today.  
(There are some code modifications around FFI.)

```haskell
https://junjihashimoto.github.io/hugs-js/
https://github.com/junjihashimoto/hugs-js

```

It can also be called with nodejs, and I created a demo running reversi.

```haskell
https://junjihashimoto.github.io/hugs-js/reversi/
https://github.com/junjihashimoto/hugs-js/tree/master/sample

```
