Skip to content

Instantly share code, notes, and snippets.

View pete-murphy's full-sized avatar

Pete Murphy pete-murphy

View GitHub Profile
module Main where
import Prelude
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect.Exception (throw)
import React.Basic.DOM (render)
import React.Basic.DOM as R
import React.Basic.Events (handler_)
import React.Basic.Hooks (Component, component, useReducer, (/\))
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE RankNTypes #-}
module ValidateForm where
import Data.Function ((&))
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Traversable
function swapEither<L, A>(e: E.Either<L, A>): E.Either<A, L> {
return E.isLeft(e) ? E.right(e.value) : E.left(e.value)
}
function toRight<L>(e: E.Either<L, unknown>): E.Either<never, L | undefined> {
return E.isLeft(e) ? E.right(e.value) : E.right(undefined)
}
function validateFields(
v: FieldValues
): E.Either<FieldErrors, DAN_FAKE_SHAPE_SCHEDULER> {
module Main where
import Prelude
import Effect (Effect)
import Data.Foldable (fold)
import TryPureScript (h1, h2, p, text, list, indent, link, render, code)
import Data.Array as Array
import Data.List as List
module Main where
import Prelude
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect.Exception (throw)
import Web.DOM.NonElementParentNode (getElementById)
import Web.HTML (window)
import Web.HTML.HTMLDocument (toNonElementParentNode)
import Web.HTML.Window (document)
{- SEVEN -}
-- | Here are two data types that may help:
data Empty
data Branch left centre right
-- | a. Using these, and the outline for 'HList' above, build a heterogeneous
-- /tree/. None of the variables should be existential.
{-# LANGUAGE TupleSections #-}
module Main where
import Criterion.Main
import Data.Char (toLower)
import Data.Function (on)
import Data.List (sort)
import Data.Map (fromListWith)
module Polynomial where
import Test.QuickCheck
import Test.QuickCheck.Checkers
import Test.QuickCheck.Classes
import Data.Monoid
strip :: Eq a => a -> [a] -> [a]
strip _ [] = []
strip x ys = reverse $ dropWhile (== x) (reverse ys)
module FPtoMax where
import Data.Char
import System.Random
import Text.Read
main :: IO ()
main = do
putStrLn "What is your name?"
name <- getLine