Skip to content

Instantly share code, notes, and snippets.

@evancz
evancz / Architecture.md
Last active December 21, 2022 14:28
Ideas and guidelines for architecting larger applications in Elm to be modular and extensible

Architecture in Elm

This document is a collection of concepts and strategies to make large Elm projects modular and extensible.

We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp. You will probably merge a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state:

  1. There is a single source of truth. Traditional approaches force you to write a decent amount of custom and error prone code to synchronize state between many different stateful components. (The state of this widget needs to be synced with the application state, which needs to be synced with some other widget, etc.) By placing all of your state in one location, you eliminate an entire class of bugs in which two components get into inconsistent states. We also think yo
@quchen
quchen / trolling_haskell
Last active February 24, 2024 01:30
Trolling #haskell
13:15 <xQuasar> | HASKELL IS FOR FUCKIN FAGGOTS. YOU'RE ALL A BUNCH OF
| FUCKIN PUSSIES
13:15 <xQuasar> | JAVASCRIPT FOR LIFE FAGS
13:16 <luite> | hello
13:16 <ChongLi> | somebody has a mental illness!
13:16 <merijn> | Wow...I suddenly see the error of my ways and feel
| compelled to write Node.js!
13:16 <genisage> | hi
13:16 <luite> | you might be pleased to learn that you can compile
| haskell to javascript now
-- * Stuff
import Database.SQL (connectDB, dbquery)
import Database.Cache (cacheGet, cacheSet)
import Network.SOAP (soap)
import Control.Monad (guard)
type Oven = String
type Product = String
@roman
roman / quickfix_ghc.vim
Created June 4, 2011 22:18
Code to use QuickFix with GHC + Cabal
" let mapleader='\'
" When using \b on normal mode, it will compile the
" project
nmap <LEADER>b :<C-u>make<CR>
" Close the QuickFix window just with the q
au FileType qf nnoremap <buffer> q :<C-u>cclose<CR>
" After compiling, open the QuickFix window if there