是否可以将一条长线#! nix-shell -p
分成多条线?
例子:
#!/usr/bin/env nix-shell
#! nix-shell -p "haskell.packages.ghc822.ghcWithPackages (p: with p; [lens text bytestring hspec brick async])"
#! nix-shell -i "runghc"
{-# language OverloadedStrings #-}
import Data.Text
import Control.Lens
import Data.Monoid
main = print $ ("foo" :: Text, True) & _1 %~ (<> " bar")
我试过这样,但毫不奇怪,GHC 没有看到镜头和文本包。
#!/usr/bin/env nix-shell
#! nix-shell -p "haskell.packages.ghc822.text"
#! nix-shell -p "haskell.packages.ghc822.lens"
#! nix-shell -p "haskell.packages.ghc822.ghc"
#! nix-shell -i "runghc"
{-# language OverloadedStrings #-}
import Data.Text
import Control.Lens
import Data.Monoid
main = print $ ("foo" :: Texts, True) & _1 %~ (<> " bar")
我依稀记得有人在 GitHub 上#!
为 nix 编写了一个自定义解释器,它允许对 Haskell(和其他)包依赖项进行特殊处理,允许它们分解成多行,但它的名字让我难以理解,我找不到它。也许你们中的一些人还记得?
我可以尝试其他任何想法吗?