Skip to content

Instantly share code, notes, and snippets.

@o1lo01ol1o
o1lo01ol1o / Poly.hs
Created March 23, 2022 11:34
Rough experiments encoding Poly in haskell
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
jbetz> is `rhyolite` for enabling the frontend to subscribe to backend events via web sockets? and has anyone outside of obsidian tried using it?
02:06 <Cale> jbetz: rhyolite is a bunch of partially-baked miscellaneous libraries which are at various levels of polish, but which we needed to open-source early for various reasons. Use it at your own risk, but please let us know if you find anything particularly good/bad if you do end up trying it out.
02:07 We've been breaking out pieces of it, taking off the sharp edges, and open sourcing them as separate libraries as time permits.
02:08 Rhyolite.Backend.App does contain something like what you described though
02:10 → mtesseract joined (~moritz@x5d8555ca.dyn.telefonica.de)
02:13 <jbetz> Cale: gotcha. I got curious when I started looking through obsidian's tezos projects.
02:18 also, I really like the idea of widget's subscribing to database queries. there's a clojure project called `precept` that pretty much does this. the database is just a graph of facts, wi
@o1lo01ol1o
o1lo01ol1o / Main.hs
Created October 25, 2019 18:28
Dump schema given beam
module Main where
import qualified Database.Beam.Backend.SQL as Beam
import qualified Database.Beam.Backend.Types as Beam
import qualified Database.Beam.Migrate as Beam
import qualified Database.Beam.Migrate.Backend as Beam
import qualified Database.Beam.Migrate.Generics as Beam
import qualified Database.Beam.Migrate.Simple as Beam
import Database.Beam.Postgres.Syntax (PgCommandSyntax, pgRenderSyntaxScript, fromPgCommand, pgBigSerialType)
import qualified Database.Beam.Postgres as Beam
-- | Examples
data Foo = Foo {foo1:: Double, foo2:: Bar} deriving (Show, GHC.Generic)
instance Generic Foo
instance HasDatatypeInfo Foo
data Bar =
Bar
| Bar2 deriving (Show, GHC.Generic)
@o1lo01ol1o
o1lo01ol1o / .spacemacs
Created December 6, 2018 15:42
current-spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@o1lo01ol1o
o1lo01ol1o / Readme.md
Last active November 7, 2018 05:33
Axiom and Reflex project skeleton
@o1lo01ol1o
o1lo01ol1o / .spacemacs
Last active October 31, 2018 19:48
nixos CI pipes
;; -*- mode: emacs-lisp; lexical-binding: t -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
@o1lo01ol1o
o1lo01ol1o / configuration.nix
Created October 11, 2018 16:38
simple-hydra with hydra-master
{ config, pkgs, lib, ...}:
{
services.hydra.package = pkgs.hydra.overrideAttrs (o: { src = (pkgs.fetchFromGitHub {
owner = "nixos";
repo = "hydra";
rev = "e0f204f3da6245fbaf5cb9ef59568b775ddcb929";
sha256 = "66002da8d68027b8a5edaf03bd81dd8b6327397311d71398776e1d3ef1ec96e1";
});
});
imports = [
traverseConcurrentlyWith :: Traversable f => Int -> (a -> IO b) -> f a -> IO (f b)
traverseConcurrentlyWith count f t0 = do
(queue, t1) <- atomically $ do
queueDList <- newTVar id
t1 <- for t0 $ \x -> do
res <- newEmptyTMVar
modifyTVar queueDList (((x, res):) .)
pure . atomically $ takeTMVar res
dlist <- readTVar queueDList
queue <- newTVar $ dlist []
@o1lo01ol1o
o1lo01ol1o / ghcopts.cabal
Created July 28, 2018 20:41
ghc warning flags
# ghc-options:
# - -Weverything
# - -Wno-missing-exported-signatures # missing-exported-signatures turns off the more strict -Wmissing-signatures. See https://ghc.haskell.org/trac/ghc/ticket/14794#ticket
# - -Wno-missing-import-lists # Requires explicit imports of _every_ function (e.g. '$'); too strict
# - -Wno-missed-specialisations # When GHC can't specialize a polymorphic function. No big deal and requires fixing underlying libraries to solve.
# - -Wno-all-missed-specialisations # See missed-specialisations
# - -Wno-unsafe # Don't use Safe Haskell warnings
# - -Wno-missing-local-signatures # Warning for polymorphic local bindings. Don't think this is an issue
# - -Wno-monomorphism-restriction # Don't warn if the monomorphism restriction is used