

UUID in Purescript
I ran into a situation the other day where UUID was needed. Sadly, the UUID module in pursuit depends on an npm package. So, I rolled my own.
I’d be happy to hear of any holes in my implementation and any other critiques anyone has to offer.
Here’s the code:
undefined
module UUID where import Prelude import Data.Either (Either(..)) import Data.Int.Bits ((.|.)) import Data.Maybe (Maybe(..)) import Data.String (joinWith, length) import Data.String.Regex (regex, test) import Data.String.Regex.Flags (noFlags) import Effect (Effect) import Data.Int (floor, hexadecimal, toNumber, toStringAs) import Effect.Random (random) import Data.Array (replicate) newtype UUID = UUID String instance showUUID :: Show UUID where show (UUID uuid) = uuid derive instance eqUUID :: Eq UUID derive instance ordUUID :: Ord UUID randomInt :: Int -> Int -> Effect Int randomInt min max = do r <- random pure $ floor $ r * toNumber (max - min + 1) + toNumber min padStart :: Int -> String -> String padStart ta
PureScript for Scala devs
Click to view this content.
#fp #functionalprogramming #purescript #scala
A Whirlwind Tour of PureScript • Rob Howard • YOW! 2016
Click to view this content.
This presentation was recorded at YOW! 2016. #GOTOcon #YOW https://yowcon.com/
Rob Howard - Software Engineer at Ambiata @damncabbage
RESOURCES https://x.com/damncabbage https://chaos.social/@buzzyrobin https://github.com/damncabbage / buzzyrobin
https://rhoward.id.au/Links http://robhoward.id.au/talks/2016/04/... https://github.com/damncabbage/ylj16-... https://github.com/damncabbage/puresc... https://www.purescript.org/
ABSTRACT This talk and workshop/jam will introduce you to PureScript, a strongly-typed, Haskell-inspired programming language that compiles to JavaScript. These sessions will focus on building a small game in incremental steps, from simple functions to a web-based app, giving you a chance to try out features and libraries along the way. You should leave the session with a grasp of PureScript fundamentals, and a self-sufficiency to tackle your own projects and experiments.
RECOMMENDED BOOKS Phil Freeman • PureS
Flood fill - image transition effect in 16 lines of pure JS
cross-posted from: https://lemmy.world/post/20776659
A quick, naive AI generated Purescript translation (quickly generated that probably doesn’t work but will help get me started later)
undefined
module Main where import Prelude import Effect (Effect) import Effect.Aff (launchAff_) import Effect.Aff.Timer (setInterval) import Effect.DOM (window) import Web.HTML (document) import Web.HTML.Document (getElementById) import Web.HTML.Element (Element, toElement) import Web.HTML.HTMLCanvasElement (getContext2D, getCanvasElementById) import Web.HTML.Canvas.Image (newImage, getWidth, getHeight, setSrc) import Web.HTML.Canvas.CanvasRenderingContext2D (CanvasRenderingContext2D, drawImage) import Web.HTML.Types (CanvasElement, Image) import Web.DOM.Node.Types (Node) foreign import requestAnimationFrame :: (Effect Unit -> Effect Unit) -> Effect Unit -- Loads the image and begins the animation startAnimation :: Effect Unit startAnimation = do img <- newImage setSrc img "example1.jpg" canvas <
How to make a quick and pretty PureScript web app
Click to view this content.
This video demonstrates a quick way to have something nice running with purescript (react + tailwind css + shadcn/ui components)
Repository: https://github.com/Zelenya/purescript-shadcn-tailwind-copypaste
Check out my course "How to think like a functio programmer": https://impurepics.thi/.
#fp #functionalprogramming #purescript
Dependent Types in PureScript by Mike Solomon, creator of Deku
Learn a bit about PureScript, the world's favorite dependently-typed language
I've seen a bit of chatter recently in the PS community about dependent types. Many of us that have been using PureScript for years love it because of its simplicity and elegance, and there has been resistance in the community to build out the complexity, both syntax-wise and implementation-wise, of a full-blown dependently-typed language à la Idris and Agda.
But another reason that there's not much community momentum behind adding dependent types to PureScript is because PureScript already has dependent types 😁
Purus: Purescript -> UPLC | POA #1
Click to view this content.
Making a simple node program with Purescript
For whatever reason, I decided at 27:00 Friday that I should make a program that would get audio fr…
For whatever reason, I decided at 27:00 Friday that I should make a program that would get audio from videos of a Youtube channel. This article will go over the details on why and how I made this with Purescript (and some FFI).
Teaser for the benefits of strongly typed pure functional programming
PolyConf 15: Post FRP Frontend Programming / Bodil Stokke
Click to view this content.
"PureScript (Maybe This Time We Get JavaScript Right)" by Bodil Stokke
Click to view this content.