homebrew-core/Formula/idris.rb

51 lines
1.6 KiB
Ruby

class Idris < Formula
desc "Pure functional programming language with dependent types"
homepage "https://www.idris-lang.org/"
url "https://github.com/idris-lang/Idris-dev/archive/v1.3.4.tar.gz"
sha256 "7289f5e2501b7a543d81035252ca9714003f834f58b558f45a16427a3c926c0f"
license "BSD-3-Clause"
head "https://github.com/idris-lang/Idris-dev.git", branch: "master"
bottle do
sha256 monterey: "704add14a985699c70650b364a9069f1a2b4ad52f9238890067d695744db63e4"
sha256 big_sur: "19ad0c1b5aed35799c1a7199418e96b509b19b5fdad8dcf6492ca0ec10b14676"
sha256 catalina: "c38a0f42b48ace8818f060ed26834d9e395e614f12fe6449b1e48513c73dcec8"
sha256 x86_64_linux: "f85bad06ae4d62578f441d915a3c0d47e3bb1064c1615883ebaa90f2a51c106c"
end
depends_on "cabal-install" => :build
depends_on "pkg-config" => :build
depends_on "ghc@8.8"
depends_on "libffi"
uses_from_macos "ncurses"
uses_from_macos "zlib"
def install
system "cabal", "v2-update"
system "cabal", "--storedir=#{libexec}", "v2-install", *std_cabal_v2_args
end
test do
(testpath/"hello.idr").write <<~EOS
module Main
main : IO ()
main = putStrLn "Hello, Homebrew!"
EOS
system bin/"idris", "hello.idr", "-o", "hello"
assert_equal "Hello, Homebrew!", shell_output("./hello").chomp
(testpath/"ffi.idr").write <<~EOS
module Main
puts: String -> IO ()
puts x = foreign FFI_C "puts" (String -> IO ()) x
main : IO ()
main = puts "Hello, interpreter!"
EOS
system bin/"idris", "ffi.idr", "-o", "ffi"
assert_equal "Hello, interpreter!", shell_output("./ffi").chomp
end
end