Skip to content

Instantly share code, notes, and snippets.

View ethercrow's full-sized avatar

Dmitry Ivanov ethercrow

View GitHub Profile
@gelisam
gelisam / GhcidForGloss.hs
Created November 30, 2019 17:15
live-reload a file containing a (Float -> Picture) expression
-- in response to https://www.reddit.com/r/haskell/comments/e3mm0k/options_for_interactive_haskell/
-- gloss can be used to interactively define animations, but you have to jump
-- through a number of hoops. Usually, interactively defining haskell programs
-- is easy: run @ghcid --test=main@ in a different terminal, and it will
-- re-compile and re-run (if there are no parse/type errors) your program
-- everytime you save the source file. Unfortunately, ghci and ghcid run their
-- expressions in a separate thread, but on some platforms such as macOS, gloss
-- can only run from the main thread! So we have to write a simple variant of
-- ghcid which runs gloss on the main thread and only reloads the portion of the
FROM fpco/stack-build:lts-14.20 as build
WORKDIR /app
COPY .init-stack.yaml stack.yaml
COPY .init-stack.yaml.lock stack.yaml.lock
COPY .init-package.yaml package.yaml
RUN stack build --only-dependencies
COPY . .