Skip to content

Instantly share code, notes, and snippets.

View ajnsit's full-sized avatar
🚕
Places to go, things to do

Anupam <|> अनुपम ajnsit

🚕
Places to go, things to do
View GitHub Profile
@ajnsit
ajnsit / ZipArray.purs
Created December 10, 2021 07:12
ZipArrays - Applicative and Monadic zipping for PureScript Arrays
module Data.Array.ZipArray where
import Prelude
import Control.Alt (class Alt)
import Control.Alternative (class Alternative)
import Control.Lazy (class Lazy)
import Control.Monad.Rec.Class (class MonadRec)
import Data.Array as A
import Data.Array as A
@ajnsit
ajnsit / publishing-packages.md
Created January 12, 2021 04:02 — forked from ursi/publishing-packages.md
The current process for Publishing PureScript packages

PureScript is currently in a transitional period with regards to how new packages are published. As such, the process of publishing a package is rather arduous. You will need: spago, pulp, and bower.

  1. Make sure your package name is unique by searching for it in bower-packages.json and new-packages.json. Alternatively you can search Pursuit as well, but those two files are the sources of truth.
  2. Make sure the module names in your package are globally unique by searching for them on Pursuit. Unfortunately this is a requirement with the current technology. However, finding a module with the same name on Pursuit doesn't mean all hope is lost. Module names only have to be unique in the package set. So you can use the information in step 6 to see if your module name is actually taken. There is a good number of package
@ajnsit
ajnsit / dictionary.h
Last active August 26, 2023 08:18
Purescript to C++ compiler runtime from - https://github.com/andyarvanitis/purescript-native/
///////////////////////////////////////////////////////////////////////////////
//
// Module : dictionary.h
// Copyright : (c) Andy Arvanitis 2018
// License : BSD
//
// Maintainer : Andy Arvanitis
// Stability : experimental
// Portability :
//
@ajnsit
ajnsit / Mantras.md
Created November 29, 2020 06:09
Mantras for a productive computing life
  1. Easy things should be easy, and difficult things should be possible.
  2. No config for old men.
@ajnsit
ajnsit / Eqq.hs
Created November 12, 2020 05:44
An example of an equality class that works across different types
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Eqq where
@ajnsit
ajnsit / Main.purs
Last active September 27, 2020 17:09
Testing Purescript's Erlang Backend (https://github.com/purerl/purerl). Comparison with Caramel (https://github.com/AbstractMachinesLab/caramel) for OCaml -> Erlang conversion.
module Main where
import Control.Bind (bind, discard)
import Data.Function (($))
import Data.Maybe (Maybe(..))
import Data.Semigroup ((<>))
import Data.Show (show)
import Data.Unit (Unit)
import Effect (Effect)
import Effect.Class.Console (log)
@ajnsit
ajnsit / SerialiseKnots.hs
Last active August 26, 2020 02:14
Serialising data structures with sharing (i.e. after "tying the knot")
{-# LANGUAGE ExistentialQuantification #-}
module SerialiseKnots where
import System.Mem.StableName
import Data.Map (Map)
import qualified Data.Map as Map
import Control.Monad.Trans.State
import Control.Monad.Trans.Class
import Control.Monad (when)
module Main where
import Prelude
import Concur.Core (Widget)
import Concur.React (HTML)
import Concur.React.Props (ReactProps, height, stroke, strokeWidth, unsafeMkProp, viewBox, width)
import Concur.React.Run (runWidgetInDom)
import Concur.React.SVG (line, svg)
import Control.Alt ((<|>))
@ajnsit
ajnsit / Main.purs
Last active June 6, 2020 17:50
Try-Purescript, simple up/down counter example with Concur
module Main where
import Prelude
import Effect (Effect)
import Concur.Core (Widget)
import Concur.React (HTML)
import Concur.React.DOM as D
import Concur.React.Props as P
import Concur.React.Run (runWidgetInDom)
module Main where
import Affjax as AX
import Affjax.ResponseFormat as ResponseFormat
import Concur.Core (Widget)
import Concur.React (HTML)
import Concur.React.DOM as D
import Concur.React.Props as P
import Concur.React.Run (runWidgetInDom)
import Control.Alt ((<|>))