Skip to content

[UX] Current mechanism to install several libraries and expose them to the user? #9581

Open
@ivanperez-keera

Description

One of Haskell's strongest points is ability to create DSLs, including languages meant for users who did not need to or want to learn Haskell, or the intricacies of our tools.

Prior to the removal of sandboxes, DSLs defined in libraries could easily be made available to the user in a controlled way:

cabal v1-sandbox init
cabal v1-install all_subdirs # or package names
cabal v1-exec -- runhaskell DSLExample.hs

This was excellent especially for users who were not proficient in Haskell (nor did they need to be), since Haskell was just the vehicle to get things running and they only needed to install the libraries once. What they cared about was just being able to run their examples. Such users did not need to or care about cabal, nor did they need to learn it.

Modules were also simple, there were no haskellisms in them. See for example, a Copilot module:
https://github.com/Copilot-Language/copilot?tab=readme-ov-file#examples

We could almost alias:

alias copilot='cabal v1-exec -- runhaskell'

Adjusting the PATH and SANDBOX_DIR, we could even enable that to run from anywhere. It was a great user experience with minimal effort on the user side.

If a user messed up, the way to guarantee that they were exactly back to the starting point was trivial: rm -rf .cabal-sandbox and re-install. With only two installation instructions (v1-sandbox init and v1-install <packages>), it didn't get much smoother than this. Doing so also did not affect any other Haskell packages installed on that machine.

Since the removal of sandboxes, we've struggled to deliver a similar user experience with v2-. To this day, I have no idea how to install copilot from the repository directly without exposing the users to added complexity and more haskellisms.

For example, we could ask them to create a cabal.project every time they want to run a Copilot file. But now there's another file they need to create, every time they want to run an example.

We could also tell them to do:

cabal v2-install --lib copilot

but AFAIK installing libraries globally is discouraged (?).

We could ask them to create a cabal file. But that is a HUGE ask and exposes them to an unbearable amount of complexity. Our target users will simply refuse to use Copilot if that's a requirement.

We could ask them to add the dependencies at the top of their file, with something like:

#!/usr/bin/env cabal
{- cabal:
build-depends: base, copilot
-}

but that now exposes a very ugly element to them that they neither understand nor they care about.

I've been trying to make the user experience simple for our users. Ideally, they could install the DSL libraries once and forget about them. (I've tried to create a Homebrew formula unsuccessfully).

Although I am using Copilot as an example, I think this applies beyond the specifics of that project. One of the reasons why we cannot offer more EDSLs is precisely because installation becomes a show-stopper.

The ability to support EDSLs has been one of Haskell's strongest suites for decades, but it only goes so far as the user experience surrounding such languages is devoid of complexity.

What is the current mechanism to enable such use cases?

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions