Automatically finds dependencies and runs a Haskell file with stack (no cabal manifest, no stack.yaml, no project, no friction)
Haskell Shell Makefile
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
extract-dependencies Bump extract-dependencies to 0.2.0.1 May 31, 2016
file-modules
package-description-remote
stack-run-auto
test-files
.gitignore
.travis.yml
LICENSE Initial commit Nov 24, 2015
Makefile
README.md
module-package
stack-try

README.md

stack-run-auto

Automatically finds dependencies and runs a Haskell script (no cabal manifest, no stack.yaml, no project).

Installation

With stack:

stack install stack-run-auto

Manually (recommended):

git clone https://github.com/yamadapc/stack-run-auto
cd stack-run-auto/stack-run-auto
stack install

Usage

stack-run-auto Test.hs

This will:

  • Find the imported modules from this Haskell file and it's local dependencies
  • Find the package containing each of these modules using the Hayoo search-engine to query for the module trying to find from which package it came from
  • Find dependencies for all the packages resolved
  • Cache this on $HOME/.stack-run-auto
  • Run stack runghc File.hs --package package1 --package package2 ...

Example output on an Yesod project

~ $ ./stack-run-auto Application.hs
Parsing Application.hs
---> Parsed imports (0.009082s)
Finding package for Yesod.Default.Config2...
Finding package for Yesod.Core.Types...
Finding package for Yesod.Static...
Finding package for Yesod.Auth...
Finding package for Yesod.Default.Util...
Finding package for Network.Wai.Handler.Warp...
Finding package for Language.Haskell.TH.Syntax...
Finding package for Database.Persist.Postgresql...
Finding package for Data.Yaml...
Finding package for Data.FileEmbed...
Finding package for Data.Aeson...
Finding package for Control.Exception...
Finding package for ClassyPrelude.Yesod...
Finding package for Database.Persist.Quasi...
Finding package for Yesod.Core.Unsafe...
Finding package for Yesod.Auth.Message...
Finding package for Yesod.Auth.Email...
Finding package for Text.Jasmine...
Finding package for Text.Hamlet...
Finding package for Database.Persist.Sql...
Finding package for System.Log.FastLogger...
Finding package for Network.Wai.Middleware.RequestLogger...
Finding package for Control.Monad.Logger...
---> Found package for Network.Wai.Handler.Warp (3.596237s)
---> Found package for Data.FileEmbed (3.613856s)
---> Found package for Database.Persist.Postgresql (3.628068s)
---> Found package for Database.Persist.Quasi (3.629282s)
---> Found package for Yesod.Default.Util (3.630724s)
---> Found package for Yesod.Core.Unsafe (3.633724s)
---> Found package for Yesod.Core.Types (3.634s)
---> Found package for Language.Haskell.TH.Syntax (3.640132s)
---> Found package for Yesod.Default.Config2 (3.640586s)
---> Found package for ClassyPrelude.Yesod (3.641378s)
---> Found package for Yesod.Auth.Message (3.64284s)
---> Found package for Yesod.Auth (3.646053s)
---> Found package for Data.Yaml (3.653229s)
---> Found package for Control.Monad.Logger (3.664165s)
---> Found package for Network.Wai.Middleware.RequestLogger (3.664609s)
---> Found package for Database.Persist.Sql (3.666917s)
---> Found package for Text.Hamlet (3.672066s)
---> Found package for Text.Jasmine (3.672255s)
---> Found package for Yesod.Auth.Email (3.679442s)
---> Found package for Data.Aeson (3.868004s)
---> Found package for Control.Exception (3.869141s)
---> Found package for Yesod.Static (3.909615s)
---> Found package for System.Log.FastLogger (3.914372s)
Finding dependencies for yesod...
Finding dependencies for yesod-core...
Finding dependencies for yesod-auth...
Finding dependencies for yesod-static...
Finding dependencies for warp...
Finding dependencies for template-haskell...
Finding dependencies for persistent-postgresql...
Finding dependencies for yaml...
Finding dependencies for file-embed...
Finding dependencies for aeson...
Finding dependencies for base...
Finding dependencies for classy-prelude-yesod...
Finding dependencies for persistent...
Finding dependencies for hjsmin...
Finding dependencies for shakespeare...
Finding dependencies for fast-logger...
Finding dependencies for wai-extra...
Finding dependencies for monad-logger...
---> Found dependencies for template-haskell (0.79311s)
---> Found dependencies for yesod-static (0.797071s)
---> Found dependencies for yesod (0.811596s)
---> Found dependencies for yesod-auth (0.831798s)
---> Found dependencies for file-embed (0.868215s)
---> Found dependencies for yesod-core (0.87035s)
---> Found dependencies for persistent-postgresql (0.892851s)
---> Found dependencies for yaml (0.900229s)
---> Found dependencies for classy-prelude-yesod (0.910601s)
---> Found dependencies for warp (0.912838s)
---> Found dependencies for shakespeare (0.917047s)
---> Found dependencies for aeson (0.923956s)
---> Found dependencies for fast-logger (0.928013s)
---> Found dependencies for persistent (0.9371s)
---> Found dependencies for monad-logger (0.93952s)
---> Found dependencies for wai-extra (0.942007s)
---> Found dependencies for hjsmin (0.942088s)
---> Found dependencies for base (0.947236s)
stack runghc Application.hs --package yesod --package yesod-core --package yesod-auth --package yesod-static --package warp --package template-haskell --package persistent-postgresql --package yaml --package file-embed --package aeson --package base --package classy-prelude-yesod --package persistent --package hjsmin --package shakespeare --package fast-logger --package wai-extra --package monad-logger --package yesod-persistent --package yesod-form --package monad-control --package transformers --package wai --package blaze-html --package blaze-markup --package safe --package data-default --package unordered-containers --package text --package directory --package bytestring --package conduit-extra --package streaming-commons --package wai-logger --package semigroups --package time --package path-pieces --package blaze-builder --package mtl --package clientsession --package random --package cereal --package old-locale --package containers --package transformers-base --package cookie --package http-types --package case-insensitive --package parsec --package vector --package conduit --package resourcet --package lifted-base --package unix-compat --package exceptions --package deepseq --package mwc-random --package primitive --package word8 --package auto-update --package byteable --package authenticate --package base16-bytestring --package cryptohash --package mime-mail --package persistent-template --package http-client --package http-conduit --package email-validate --package base64-bytestring --package binary --package nonce --package old-time --package wai-app-static --package cryptohash-conduit --package mime-types --package filepath --package process --package async --package attoparsec --package css-text --package hashable --package array --package bytestring-builder --package ghc-prim --package iproute --package http2 --package simple-sendfile --package vault --package stm --package pretty --package postgresql-simple --package postgresql-libpq --package scientific --package enclosed-exceptions --package dlist --package syb --package classy-prelude --package classy-prelude-conduit --package yesod-newsfeed --package resource-pool --package http-api-data --package silently --package tagged --package language-javascript --package network --package data-default-class --package ansi-terminal --package void --package stringsearch --package zlib --package transformers-compat --package stm-chans --package monad-loops
# Stack runs...

License

This code is licensed under the MIT license. For more information please refer to the LICENSE file.

Donations

Would you like to buy me a beer? Send bitcoin to 3JjxJydvoJjTrhLL86LGMc8cNB16pTAF3y