Skip to content

Instantly share code, notes, and snippets.

View i-am-the-slime's full-sized avatar
🪝

Mark Eibes i-am-the-slime

🪝
View GitHub Profile
@i-am-the-slime
i-am-the-slime / ObjectMap.purs
Last active February 3, 2024 17:12
Object that allows using any String newtype as the keys
module Sentence.Biz.Types.ObjectMap
( ObjectMap(..)
, empty
, isEmpty
, size
, singleton
, insert
, lookup
, toUnfoldable
, toAscUnfoldable
module BuildTime.GetMDXFiles where
import Prelude
import Node.FS.Aff (readTextFile, readdir)
import Data.Foldable (for_)
import Node.Glob.Basic (expandGlobsCwd)
import BuildTime.MDXBundler (EsbuildOptions, Extension(Extension), RehypePlugin, RemarkPlugin, addLoader, addRehypePlugins, addRemarkPlugins, bundleMDX, setPlatform)
import Node.Encoding (Encoding(..))
import Debug (spy)
import Effect.Aff (launchAff_)
module GraphQL.FunDeps where
import Prelude
import Data.Either (Either(..))
import Data.Foldable (foldMap)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Semigroup.Foldable (intercalateMap)
import Data.String as String
module Main where
import Prelude
import Effect (Effect)
import TryPureScript (p, render, text)
import Data.Generic.Rep (class Generic, Constructor, Sum(..), from)
import Data.Reflectable (class Reflectable, reflectType)
import Type.Proxy (Proxy(..))

Motivation

Let's say we have the following data:

hobby :: { name :: String }
hobby = { name: "Football" }

Before visible type applications we could write this:

module SelectionManager where
import Yoga.Prelude.View
import Data.Set (Set)
import Data.Set as Set
import Hooks.UseSelectable (UseSelectable, UseSelectableResult, useSelectable)
type State a =
{ selection ∷ Set a
@i-am-the-slime
i-am-the-slime / PrintSideBySide.purs
Last active September 5, 2022 15:45
Print two strings side-by-side for easy comparison
module Main where
import Prelude
import Data.Array (intercalate, zip)
import Data.Foldable (fold)
import Data.String.Utils (lines, padEnd)
import Effect.Console (log)
import Data.Tuple.Nested ((/\))
import TryPureScript (render, code, text, p)
exports.purescriptSyntax = {
displayName: "Purescript",
name: "purescript",
mimeTypes: ["text/purescript"],
fileExtensions: ["purs"],
editorOptions: { tabSize: 2, insertSpaces: true },
lineComment: "--",
blockCommentStart: "{-",
blockCommentEnd: "-}",
keywords: [
data OnConflict = OnConflictDoNothing | OnConflictDoUpdate
-- | typeclass-alias for `genericShowInsert` constraints
class GenericShowInsertOnConflict t r where
genericShowInsertOnConflict
∷ { ph ∷ String }
→ Table t
→ Array { | r }
-> OnConflict
→ String
@i-am-the-slime
i-am-the-slime / How to build an Apple Silicon version of the PureScript compiler.md
Last active July 7, 2022 10:06
How to build an Apple Silicon version of the PureScript compiler

How to build an Apple Silicon version of the PureScript compiler

Updates:

2022-07-01

Add prebuilt binary for 0.15.4

2022-06-24

I changed ghc to be installed with ghcup and ghc version to 9.2.3 to match PS 0.15.3 added the RELEASE flag.