...
...
...
Solid is a modern remix of (GHC) Haskell with a focus on productivity and joy for programmers.
git clone git@github.com:sol/solid.git
cd solid
cabal install
#!/usr/bin/env solid
names :: [String]
names = ["Jane", "Joe"]
main :: IO ()
main = do
name <- names.randomChoice
stdout.writeLine "Hey {name} π"
-- or point-free
main :: IO ()
main = stdout.writeLine . "Hey {} π" =<< names.randomChoice
$ solid main.hs
Hey Jane π
or
$ chmod +x main.hs
$ ./main.hs
Hey Joe π
Read: book/README.md
solid
installs GHC 9.8.2
to a private location. It does not use any system
provided GHC.
solid
caches packages in ~/.local/state/solid/store/
. It does not use the
user-global cabal store.
It is possible to use Haskell Language Server to get LSP diagnostics while developing a script. This requires the following configuration file next to your script:
# hie.yaml
cradle:
bios:
shell: "solid ghc-options $HIE_BIOS_ARG > $HIE_BIOS_OUTPUT"
You can use third-party tools that expect GHC options with solid
.
Example:
# start a GHCi session
$ solid with ghci main.hs
# run doctest
$ solid with doctest main.hs
# run sensei
$ solid with sensei main.hs
solid with
does two things:
- It puts a suitable version of GHC on the
PATH
- It calls the specified executable with all required GHC options
solid with
can be used to run doctest
. However, this only works if a
suitable version of doctest
is available on the PATH
. solid doctest
provides a more robust way to run doctest
.
Example:
$ solid doctest main.hs
As of now, solid
does not provide a mechanism to manage third-party
dependencies. This limitation will be lifted eventually.
However, solid
accepts arbitrary GHC options, including -package
, which can
be used to specify arbitrary additional Haskell dependencies.
Example:
$ solid with ghci -package=hspec -package=QuickCheck test/Spec.hs
Note that for this to work, a version of the requested package has to be
present in the cabal store. If a package is not yet in the cabal store, then
you have to populate the cabal store manually, e.g. with cabal repl --build-depends
.
Example:
$ echo | cabal repl --build-depends hspec,QuickCheck
-
The
where
inmodule ... where
has to be followed by a newline, e.g. this is not supported:module Foo where bar :: Int bar = 23