Skip to content

Instantly share code, notes, and snippets.

View shamansir's full-sized avatar

Ulric Wilfred shamansir

View GitHub Profile
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE FlexibleInstances #-}
module Errors2 where
import Prelude
import Control.Monad.Identity
@shamansir
shamansir / Playground.hs
Created December 10, 2019 00:32
WFC Haskell
coin1 = 0.5 .* return Heads + 0.5 .* return Tails :: P Coin
runW coin1
--albert Heads
--albert Tails
@shamansir
shamansir / Covered.purs
Last active May 21, 2021 12:45
PureScript & Haskell Errors
module Rpd.API.Covered where
data Covered error state =
Covered (Array error) (Maybe state)
nothing :: forall error state. Covered error state
nothing =
Covered [] Nothing
@shamansir
shamansir / Decode.elm
Last active November 26, 2019 08:14
Decode Problem
module Main exposing (main)
import Browser
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
import Dict
import Json.Decode as D
import Json.Encode as E
@shamansir
shamansir / Dockerfile
Created September 29, 2019 14:34
Docker: PureScript 0.12 + Spago
FROM ubuntu:19.04
ENV PROJECT my-project
RUN addgroup --system user && adduser --system --group user
RUN addgroup --system node && adduser --system --group node
RUN mkdir -p /home/node
RUN mkdir -p /home/node/.nvm
RUN chown -R node:node /home/node && chmod -R 755 /home/node
@shamansir
shamansir / Example.purs
Created September 11, 2019 18:59
TreeAna
-- from: https://gist.github.com/kapranov-anton/86d44e4d382c2c38ffb5d59e331bc93a
module Main where
import Prelude
import Data.List (List)
import Data.List as List
import Control.Monad.Eff (Eff)
msg: MsgOne {}
uuid: '336228ee-b2e8-4c78-acf4-a8302125552b'
(MSG-ONE:336228ee-b2e8-4c78-acf4-a8302125552b)-|
msg: MsgTwo {}
uuid: 'cbfeae0b-11f1-4e58-a4f9-35bab61bdbf2'
uuid: '7965f57f-cde5-4ca5-8377-bd03b9c71784'
(MSG-TWO:7965f57f-cde5-4ca5-8377-bd03b9c71784)-(MSG-ONE:cbfeae0b-11f1-4e58-a4f9-35bab61bdbf2)-|
msg: MsgTwo {}
uuid: '256702ea-6702-4aa2-84c0-3977e1763e8'
uuid: 'fd7bdf0d-6f6b-46d2-b394-f268c4c5a473'
@shamansir
shamansir / Noise.elm
Created March 7, 2019 19:42
Noise Generation in Elm 0.19
-- Taken from: https://raw.githubusercontent.com/eskimoblood/elm-simplex-noise/master/src/Noise.elm
-- Updated to 0.19
module Noise exposing (PermutationTable, permutationTable, noise4d, noise3d, noise2d)
{-| This is a library to generate simplex noise in Elm.
The code is a port of the [simplex noise JavaScript version](https:--github.com/jwagner/simplex-noise.js) by Jonas Wagner.
## Example usage
module ExceptT2 where
import Control.Monad.Trans.Maybe
import Data.Char (isNumber, isPunctuation)
import Control.Monad (guard)
import Control.Monad.Trans.Except
import Control.Monad.IO.Class (liftIO)
import Data.Foldable (msum)
import Data.Char (isNumber, isPunctuation)
@shamansir
shamansir / Main.purs
Created March 31, 2018 14:43 — forked from Gabriella439/Main.purs
Purescript Flare - Simon example
module Main where
import Data.Array ((..), reverse)
import Data.Int (toNumber)
import Flare (UI, radioGroup)
import Flare.Drawing (runFlareDrawing)
import Graphics.Drawing
import Graphics.Drawing.Font (font, sansSerif, bold)
import Math (cos, sin, pi)
import Prelude