mirror of
https://github.com/bennofs/nix-script
synced 2025-01-09 20:34:20 +01:00
fixes for haskellng + add example
This commit is contained in:
parent
45f2a37b67
commit
d28f2a06ea
@ -25,7 +25,7 @@ Usage
|
||||
To use `nix-script`, you need to add a header to your file. Here is an example for a haskell file `example.hs`:
|
||||
|
||||
```haskell
|
||||
#!nix-script
|
||||
#!/usr/bin/env nix-script
|
||||
#!> haskell
|
||||
#! haskell | text lens optparse-applicative
|
||||
#! shell | nix nix-prefetch-scripts
|
||||
|
8
example.hs
Executable file
8
example.hs
Executable file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env nix-script
|
||||
#!> haskell
|
||||
#! haskell | text lens optparse-applicative
|
||||
#! shell | nix nix-prefetch-scripts
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
putStrLn "It works!"
|
5
nix-script.hs
Normal file → Executable file
5
nix-script.hs
Normal file → Executable file
@ -1,4 +1,4 @@
|
||||
#!nix-bang
|
||||
#!/usr/bin/env nix-script
|
||||
#!> haskell
|
||||
#! haskell | text lens
|
||||
#! shell | nix
|
||||
@ -37,8 +37,7 @@ languages = [haskell, shell]
|
||||
haskell :: LangDef
|
||||
haskell = LangDef "haskell" d r i where
|
||||
d pkgs = return $
|
||||
"haskellPackages.ghcWithPackages (hs: with hs; [" <> Text.unwords (map mkPkg pkgs) <> "])"
|
||||
mkPkg = Text.concat . over (_tail.mapped._head) toUpper . Text.splitOn "-"
|
||||
"haskellPackages.ghcWithPackages (hs: with hs; [" <> Text.unwords pkgs <> "])"
|
||||
r script = ("runhaskell" , [script])
|
||||
i script = ("ghci" , [script])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user