CLI apps to growing the Haskell Community - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Joel McCracken

So to some extent I think an answer to this can be CLI scripting

Joel McCracken

its really nice to make CLI utilities in haskell IMO

Joel McCracken

personally I want to keep pushing to make this easier

Joel McCracken

thoughts? I think if it was better documented how to build and distrbute static executables haskell could really shine in this arena

Sridhar Ratnakumar

Rust community is doing this extremely well. See https://lobste.rs/s/2mxwdm/rewritten_rust_modern_alternatives

You make an interesting point. Neuron is one such CLI :-D and I'm in the middle of planning for another one.

Sridhar Ratnakumar

Being able to build and distribute static executables is a big factor @Joel McCracken . I'm hoping for static Haskell executables official support to be merged in nixpkgs sooner. Until then, people have to glue it together manually (see dhall, which does it)

tristanC

On the other hand, being able to run haskell source using cabal or stack script mode is quite convenient compared to opaque static binary.

Joel McCracken

yeah, they both are great options to have

Sridhar Ratnakumar

Idea: a CLI app like https://github.com/kowainik/summoner#tui-demo - but for pandoc conversion. Since pandoc is written in Haskell, the app can just use it as a library for providing better UX (re: feedback, errors).

馃敭 馃敡 Tool for scaffolding batteries-included production-level Haskell projects - kowainik/summoner
Torsten Schmits

Sridhar Ratnakumar said:

Rust community is doing this extremely well. See https://lobste.rs/s/2mxwdm/rewritten_rust_modern_alternatives

that's a pretty neat list

Sridhar Ratnakumar

Okay, with this: https://twitter.com/sridca/status/1310925718948319234 - if we create a "template" bootstrap repository for new Haskell projects that builds static binaries, and uses Nix to provide reproducible builds, as well bulitin VScode support ("one-click" even) ... would it help @Joel McCracken ?

Torsten Schmits

static binary with reflex-dom, really???

Joel McCracken

dude i thiknk you actually are suggesting my ideal fix

Joel McCracken

i mean i dont care either way about the nix part

Joel McCracken

but if you could like make it a github repo with actions that will built the static binaries

Joel McCracken

that would probably be a huge boon

Joel McCracken

nix would probably be good because it gives a good solution for managing dependencies

Joel McCracken

i mean perhaps we could figure something else for windows

Joel McCracken

can you do nix on like cygwin

Joel McCracken

or whichever flavor of that same mess is in favor this month

Jeff Burka

nix on WSL seems to work fine

Joel McCracken

well that would be good but like

Joel McCracken

you'd have to run it IN wsl right?

Joel McCracken

thats better than nothihng

Sridhar Ratnakumar

haskell.nix provides Windows support for static binaries, apparently. Do we really care about naive Windows support though? I can make a GitHub repo either way, but GitHub Actions wouldn't work, unless we host a cache. Static builds will build the entire universe. If the cache takes <10G we can use cachix.

Sridhar Ratnakumar

For windows, I recommend WSL2. Much easier. That's what Windows users of neuron do.

Sridhar Ratnakumar

Then you can use nix for linux.

Sridhar Ratnakumar

Joel McCracken said:

you'd have to run it IN wsl right?

You can run it from cmd.exe. Just prefix your CLI with wsl. Eg: wsl neuron rib -w

Sridhar Ratnakumar

Torsten Schmits said:

static binary with reflex-dom, really???

Yes, I have a working version for Linux here: https://github.com/srid/neuron/pull/417

Trying out macOS now ...

For #183 Build and test on Linux Build and test on macOS
Joel McCracken

ill try making it work with reddup

Joel McCracken

if you think your setup is ready for a tester

Sridhar Ratnakumar

Could someone with a mac that also have homebrew installed test this? https://unix.stackexchange.com/a/385720/14042

Is there a way to run a Linux binary in macOS? I tried to run a binary but it said it isn't executable.
Sridhar Ratnakumar

Joel McCracken said:

if you think your setup is ready for a tester

No template (I think it is best to wait till nixpkgs upstream obviates step 2 of having to do a nixpkgs fork), but see: https://www.srid.ca/db359075.html

Joel McCracken

i can test on a mac; not right now but if i dont follow up in a few days ping me and tell me I am a bad person and I will

Hjulle

Sridhar Ratnakumar said:

Could someone with a mac that also have homebrew installed test this? https://unix.stackexchange.com/a/385720/14042

I first tried installing noah with nix, but it failed to run because noahbootsrap was missing.
Next I tried with brew:

brew install noah # ("brew install linux-noah/noah/noah" as instructed didn't work)

It successfully ran ($ noah), but failed during bootstrap with

curl: (6) Could not resolve host: deliver.edby.coffee
could not fetch the suite at /usr/local/bin/noahstrap line 64.

I tried running noah neuron with it anyways, but it did nothing and exited with status code 0.

I guess it's no surprise, given that the project is no longer maintained and the repo is archived: https://github.com/linux-noah/noah

Bash on Ubuntu on macOS. Contribute to linux-noah/noah development by creating an account on GitHub.
Hjulle

This seems to be the issue I ran into: https://github.com/linux-noah/noahstrap/issues/5

It looks like ubuntu.tar.gz no longer exists at http://deliver.edby.coffee/noah/ubuntu.tar.gz. Is there another copy anywhere else?
Sridhar Ratnakumar

So I guess we will provide static binaries for Linux only, unless someone can figure it out for macOS.

Hjulle

Right. Since fully static binaries are apparently not supported on MacOS. https://github.com/NixOS/nixpkgs/issues/43795#issuecomment-701108479

If you just want to build static Haskell executables right now, follow these instructions. This issue collects/links all issues and ongoing work to make fully-static building of Haskell executables...
Sridhar Ratnakumar

If anyone wants to start a Haskell CLI project, use this repo as a template (just remove the src/Ka stuff, and clean ka.cabal): https://github.com/srid/ka

Run nix-build static.nix to give you a static binary.

There is a ci.nix that you can use to do that as well.

/cc @Joel McCracken

neuron is undergoing a heart surgery. Contribute to srid/ka development by creating an account on GitHub.
Sridhar Ratnakumar

Alternatively just copy over the .nix files to your repo.

Sridhar Ratnakumar

Is there a good library for pretty printing with colors and unicorns in terminal?

Joel McCracken

unicorns? like random emoji

Joel McCracken

so @Sridhar Ratnakumar did anything change re: os x static binaries? I think its fine personally btw if i can make everything static except for the os lib

Sridhar Ratnakumar

IDK. Whatever the cool kids in Rust/Go land do to make their CLI apps pleasing.

Sridhar Ratnakumar

i gave up on osx static binaries.

Joel McCracken

well again the real issue is "what does it take to run this on another system, do i have to install a lot of dependencies", not "is this a purely static binary"

Joel McCracken

if everything is static besides the few system libs and those libs have a stable ABI, hyou'd still be able to download the executable and run it right away, right?

Sridhar Ratnakumar

probably. you might want to check out how dhall does it. i did try their macos binary on my mac, but it refused to run it giving some security excuse. apple sucks; just throw your macbooks in the trash.

Joel McCracken

hate apple's new stuff

Joel McCracken

really the only reason I still use it because its nice to be able to like plug in a device and have it work and print something randomly if I need to with a new printer

Joel McCracken

i'd be really uncomfortable with giving a talk at a place on a linux computer for example, who knows how it will react with random projector

Sridhar Ratnakumar

linux has gotten pretty good these days. i run x1 cabon connected to one thunderbolt that charges, runs a 5k monitor (retina), connects to speakers, yeti microphone, ethernet etc.. full report

Joel McCracken

Yeah i've heard similar things. I plan to explore it, perhaps things have gotten better enough where my next computers will be linux

Joel McCracken

probably gonna get a system 76 or a puresim

Sridhar Ratnakumar

laptop advice from nixos'ers: https://discourse.nixos.org/t/best-laptops-for-nixos/8545?u=srid

I鈥檓 considering buying a new laptop, and I obviously want to install NixOS on it. In the past, I鈥檝e had various difficulties with different Linuxes (NixOS including) with almost all the laptops I鈥檝e had. Which laptops do you use for NixOS? Have you had any problems? Which laptops would you consider to get along best with NixOS?
Sridhar Ratnakumar

Unless you are gaming, try to avoid nvidia graphics.

Sridhar Ratnakumar

Another vector to consider when writing CLI apps in Haskell. Create awesome UX:

https://opensource.com/life/15/3/user-experience-open-source-future

Each year, my favorite open source software survey asks "Where is the future of open source taking us?" I think we have to address and made big changes to user experience. Not just user interface, but the whole experience.
Winston Troughton

Good post, although the article focuses more on open source projects collaborating with designers.

Winston Troughton

Where can I find a designer to collaborate with?

Sridhar Ratnakumar

Sridhar Ratnakumar said:

Idea: a CLI app like https://github.com/kowainik/summoner#tui-demo - but for pandoc conversion. Since pandoc is written in Haskell, the app can just use it as a library for providing better UX (re: feedback, errors).

https://lobste.rs/s/zgsdgg/customizing_pandoc_generate_pdf_epub

Sridhar Ratnakumar

Winston Troughton said:

Where can I find a designer to collaborate with?

What I took from that post is that even as a solo developer I can pay extra special attention to UX of my app. So be both a programmer and UX specialist myself. Of course, in larger projects it is good to have a mix of people.

Sridhar Ratnakumar

https://twitter.com/ChShersh/status/1317467542634614785

Sridhar Ratnakumar

I just had an idea: a notes viewer, with full backlinks (with surrounding context, because Pandoc AST power), in command line. uses reflex FRP to auto-refresh.