Coder Social home page Coder Social logo

suntheme's Introduction

Suntheme

Runs a script on sunrise and sunset, written in pure Haskell


You may be wondering how a program written in Haskell, the purely functional programming language, could possibly act on the real world by running a so-called "script."

It's simple. We take in the entire World as an input to a pure function, the IO Monad. It then maps the original World to a new (generated) World, with our desired IO actions carefully applied with mathematical precision.

From the second perspective, an IO action transforms the whole world. IO actions are actually pure, because they receive a unique world as an argument and then return the changed world.

See this for more information.

Hacking on suntheme

It's trivial to get started with suntheme development thanks to Nix, the purely functional package manager. Naturally, we leverage it as our primary package manager, both for Hackage and development tools like language servers and the like.

First, install Nix through your preferred avenue or local system administrator. If unsure, we recommend the Determinate Nix Installer. Make sure flakes and nix-command are enabled (the Determinate Installer will enable them by default).

Once you have nix, simply type:

nix develop

Say yes to any prompts asking you to allow substituters or trust public keys. Nix will fetch all of the required packages, such as GHC and Hackage dependencies. Additionally, you will have access to hlint and the haskell-language-server.

To create a build, type

nix build

A binary will be produced in result/bin/suntheme.

To make suntheme available in the shell without outputting to result, use

nix shell

This will build a binary just like nix build but add it temporarily to the PATH, so you can just type suntheme.

To build and run suntheme immediately without adding it to the PATH, use

nix run

This will build a binary just like nix shell but immediately execute it.

suntheme's People

Contributors

youwen5 avatar quantum9innovation avatar

Watchers

 avatar

suntheme's Issues

Migrate to Nix

Use haskellNix for Haskell package management instead of cabal. This will help prepare for packaging in nixpkgs and deployment as NixOS module via flake.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.