-
create-react-native-app purescript-app; cd purescript-app
-
pulp init --force
-
pulp build
-
src/Main.js
var React = require("react");
var RN = require("react-native");
exports.text = function(props){
-- Solving Fix / Mu / Nu exercise in | |
-- https://stackoverflow.com/questions/45580858/what-is-the-difference-between-fix-mu-and-nu-in-ed-kmetts-recursion-scheme-pac | |
{-# LANGUAGE RankNTypes, GADTs #-} | |
---------------------------------------- | |
-- Fix / Mu / Nu | |
newtype Fix f = Fix { unFix :: f (Fix f) } |
#!/run/current-system/sw/bin/bash | |
SCANNED="$1" | |
AFFIX="${1##*.}" | |
DATESTAMP=$(date '+%Y%m%d') | |
TIMESTAMP=$(date '+%H%M%S') | |
mv "${SCANNED}" "/home/user/${DATESTAMP}..scan-${TIMESTAMP}.${AFFIX}" |
#!/usr/bin/env bash | |
# Installs NixOS on a Hetzner server, wiping the server. | |
# | |
# This is for a specific server configuration; adjust where needed. | |
# | |
# Prerequisites: | |
# * Update the script to adjust SSH pubkeys, hostname, NixOS version etc. | |
# | |
# Usage: |
-- Solving a dynamic programming in many ways, including using existing | |
-- recursion schemes and by defining new ones. The problem of solving this | |
-- particular problem using recursion schemes was posed by Sandy Maguire. | |
{-# LANGUAGE FlexibleContexts, RankNTypes, TypeApplications, TypeFamilies, ScopedTypeVariables #-} | |
{-# OPTIONS -Wno-orphans #-} | |
module Dyna where | |
import Test.DocTest | |
import Data.Functor.Foldable (Base, Fix, Recursive(project), Corecursive(embed, ana), hylo, cataA) |
{ config, lib, pkgs, ... }: { | |
config = { | |
boot.kernelModules = []; | |
networking = { | |
extraHosts = '' | |
xxx.xxx.xxx.xxx bob-remote bob-remote-unencrypted | |
127.0.0.1 bob-remote-encrypted | |
''; | |
firewall.trustedInterfaces = []; | |
publicIPv4 = "xxx.xxx.xxx.xxx"; |
create-react-native-app purescript-app; cd purescript-app
pulp init --force
pulp build
src/Main.js
var React = require("react");
var RN = require("react-native");
exports.text = function(props){
The question of "How do I design my application in Haskell?" comes up a lot. There's a bunch of perspectives and choices, so it makes sense that it's difficult to choose just one. Do I use plain monad transformers, mtl
, just pass the parameters manually and use IO
for everything, the ReaderT
design pattern, free monads, freer monads, some other kind of algebraic effect system?!
The answer is: why not both/all?
Lately, I've been centering on a n application design architecture with roughly three layers:
newtype AppT m a = AppT { unAppT :: ReaderT YourStuff m a } deriving ............
The ReaderT
Design Pattern, essentially. This is what everything gets boiled down to, and what everything eventually gets interpreted in. This type is the backbone of your app. For some components, you carry around some info/state (consider [MonadMetrics
](https://hackage
/* Safari and Edge polyfill for createImageBitmap | |
* https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap | |
*/ | |
if (!('createImageBitmap' in window)) { | |
window.createImageBitmap = async function(blob) { | |
return new Promise((resolve,reject) => { | |
let img = document.createElement('img'); | |
img.addEventListener('load', function() { | |
resolve(this); | |
}); |
This question was asked at the recent HaskellX conference, with both practicioners as well as teachers being present. I won't reiterate everything that was said, and instead link to a recording of the podium discussion (https://skillsmatter.com/skillscasts/10952-park-bench-panel-session-with-haskellx-experts).
One particular argument, that I've heard come up multiple times now, is that teachers are complaining about the length
function being polymorphic. Apparently length :: forall a. Foldable f => f a -> Int
is hard to grasp/understand/accept for a new-comer. The solutions proposed to solve this problem are to:
Drawbacks for 1 include that practicioners like the fact that length works for all kinds of data structures, and don't want that taken away from them. The primary problem with solution 2 is that students can't go and use their aquired knowledge to work on Open
module MapRecordWithComments where | |
-- | Type-level Tomfoolery. A million thankyous to @kcsongor and his | |
-- | unparallelled patience with me while I try to figure this stuff | |
-- | out. | |
import Prelude (($), (+), (<>), discard, show) | |
import Control.Monad.Eff (Eff) | |
import Control.Monad.Eff.Console (CONSOLE, log) |