Created
November 21, 2019 03:34
-
-
Save DarinM223/79cf9d20325cc773bd83af10978859c9 to your computer and use it in GitHub Desktop.
Example of scripting using Haskell and Cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- 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