haskellify
Brian Hicks 2019-09-08 06:10:30 -05:00
parent a3fa4e19cd
commit 2fd304394f
2 changed files with 9 additions and 12 deletions

View File

@ -1,4 +1,5 @@
{ nixpkgs ? import <nixpkgs> { }, compiler ? "ghc865" }:
(import ./release.nix { inherit compiler; }).elm-swapper.env.overrideAttrs (attrs: {
buildInputs = attrs.buildInputs ++ [ nixpkgs.git nixpkgs.elmPackages.elm nixpkgs.cabal2nix nixpkgs.cabal-install ];
buildInputs = attrs.buildInputs
++ [ nixpkgs.git nixpkgs.elmPackages.elm nixpkgs.cabal2nix nixpkgs.cabal-install nixpkgs.haskellPackages.hindent ];
})

View File

@ -4,23 +4,19 @@ import System.Directory
import System.FilePath
nearestElmJson :: IO (Maybe FilePath)
nearestElmJson =
getCurrentDirectory >>= nearestElmJsonHelp
nearestElmJson = getCurrentDirectory >>= nearestElmJsonHelp
nearestElmJsonHelp :: FilePath -> IO (Maybe FilePath)
nearestElmJsonHelp filepath = do
let candidate = filepath </> "elm.json"
exists <- doesFileExist candidate
if exists then
pure $ Just candidate
else
let next = takeDirectory filepath in
if exists
then pure $ Just candidate
else let next = takeDirectory filepath
in if next == filepath
then pure Nothing
else nearestElmJsonHelp next
if next == filepath then
pure Nothing
else
nearestElmJsonHelp next
main :: IO ()
main = do
elmJson <- nearestElmJson