Skip to content

Instantly share code, notes, and snippets.

@joe-warren
joe-warren / showdown-example.hs
Last active August 21, 2026 15:23
Showdown Example
-- https://md.ccc.ac/OSHOP2026-CAD-Showdown?both
import qualified Waterfall as W
import Linear
import Control.Lens
import Data.Function ((&))
body :: W.Solid
body =
let r = 10
f (a, b) =
#!/usr/bin/env stack
{- stack script --resolver lts-23.16
--package linear
--package lens
--package waterfall-cad
--package waterfall-cad-svg
--extra-dep waterfall-cad-svg-0.6.2.1
--extra-dep waterfall-cad-0.6.2.1
--extra-dep opencascade-hs-0.6.2.1
-}
import qualified Waterfall
import Linear (unit, _x)
text :: FilePath -> Double -> String -> Double -> IO Waterfall.Solid
text fontpath fontSize content depth = do
font <- Waterfall.fontFromPath fontpath fontSize
return . Waterfall.rotate (unit _x) (pi/2) . Waterfall.prism depth $ Waterfall.text font content
object :: IO Waterfall.Solid
object = text "/VarelaRound-Regular.ttf" 24 "Hello Hacker News" 12
import qualified Waterfall
import Linear (unit, _x)
text :: FilePath -> Double -> String -> Double -> IO Waterfall.Solid
text fontpath fontSize content depth = do
font <- Waterfall.fontFromPath fontpath fontSize
return . Waterfall.rotate (unit _x) (pi/2) . Waterfall.prism depth $ Waterfall.text font content
object :: IO Waterfall.Solid
object = text "/VarelaRound-Regular.ttf" 24 "Hello Lobste.rs " 12
@joe-warren
joe-warren / HelloDiscourse.hs
Last active July 7, 2026 11:56
HelloDiscourse.hs
import qualified Waterfall
import Linear (unit, _x)
text :: FilePath -> Double -> String -> Double -> IO Waterfall.Solid
text fontpath fontSize content depth = do
font <- Waterfall.fontFromPath fontpath fontSize
return . Waterfall.rotate (unit _x) (pi/2) . Waterfall.prism depth $ Waterfall.text font content
object :: IO Waterfall.Solid
object = text "/VarelaRound-Regular.ttf" 24 "Hello Discourse.Haskell.Org " 12
import qualified Waterfall
import Linear (unit, _x)
text :: FilePath -> Double -> String -> Double -> IO Waterfall.Solid
text fontpath fontSize content depth = do
font <- Waterfall.fontFromPath fontpath fontSize
return . Waterfall.rotate (unit _x) (pi/2) . Waterfall.prism depth $ Waterfall.text font content
threeFourFour :: IO Waterfall.Solid
threeFourFour = text "/VarelaRound-Regular.ttf" 24 "Hello Reddit" 12
import qualified Waterfall
import Linear (unit, _x)
text :: FilePath -> Double -> String -> Double -> IO Waterfall.Solid
text fontpath fontSize content depth = do
font <- Waterfall.fontFromPath fontpath fontSize
return . Waterfall.rotate (unit _x) (pi/2) . Waterfall.prism depth $ Waterfall.text font content
threeFourFour :: IO Waterfall.Solid
threeFourFour = text "/VarelaRound-Regular.ttf" 24 "Hello Mastodon!!!" 12
import qualified Waterfall
import Linear (unit, _x)
text :: FilePath -> Double -> String -> Double -> IO Waterfall.Solid
text fontpath fontSize content depth = do
font <- Waterfall.fontFromPath fontpath fontSize
return . Waterfall.rotate (unit _x) (pi/2) . Waterfall.prism depth $ Waterfall.text font content
threeFourFour :: IO Waterfall.Solid
threeFourFour = text "/VarelaRound-Regular.ttf" 24 "Hello BlueSky" 12
import qualified Waterfall as W
import Linear
import Data.Foldable
object = fold $ W.tryRoundFillet 0.1 W.unitCube
module ThreeFourFour (
threeFourFour
) where
import qualified Waterfall
import Linear (unit, _x)
text :: FilePath -> Double -> String -> Double -> IO Waterfall.Solid
text fontpath fontSize content depth = do
font <- Waterfall.fontFromPath fontpath fontSize