Skip to content

Instantly share code, notes, and snippets.

@DarinM223
Created November 21, 2019 03:34
Show Gist options
  • Save DarinM223/79cf9d20325cc773bd83af10978859c9 to your computer and use it in GitHub Desktop.
Save DarinM223/79cf9d20325cc773bd83af10978859c9 to your computer and use it in GitHub Desktop.
Example of scripting using Haskell and Cabal
{- cabal:
build-depends: base >= 4.11 && < 5,shelly,text
ghc-options: -Wall -O0
default-language: Haskell2010
-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Shelly
import Data.Foldable (traverse_)
import Data.Text
-- Run `cabal run script.hs` to run script.
--
-- Run `cabal repl --build-depends=text,shelly` and then
-- `:l script.hs` to load file in REPL.
hello :: Text
hello = "Hello, world!"
main :: IO ()
main = do
putStrLn $ unpack hello
files <- shelly $ ls "./"
traverse_ putStrLn files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment