Skip to content

Commit

Permalink
Use Text instead of String
Browse files Browse the repository at this point in the history
  • Loading branch information
georgefst authored and ad-si committed Jan 18, 2025
1 parent d7dc5fa commit a7e6937
Show file tree
Hide file tree
Showing 30 changed files with 97 additions and 21 deletions.
22 changes: 22 additions & 0 deletions brillo-examples/brillo-examples.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ executable brillo-bitmap
hs-source-dirs: picture/Bitmap
build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15

ghc-options: -O2 -Wall -threaded -rtsopts
Expand All @@ -47,6 +48,7 @@ executable brillo-boids

build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15
, random >=1.2 && <1.3

Expand All @@ -58,6 +60,7 @@ executable brillo-clock
hs-source-dirs: picture/Clock
build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15

ghc-options: -O2 -Wall -threaded -rtsopts
Expand All @@ -68,6 +71,7 @@ executable brillo-color
hs-source-dirs: picture/Color
build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15

ghc-options: -O2 -Wall -threaded -rtsopts
Expand All @@ -82,6 +86,7 @@ executable brillo-conway

build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15
, random >=1.2 && <1.3
, vector >=0.13 && <0.14
Expand All @@ -94,6 +99,7 @@ executable brillo-draw
hs-source-dirs: picture/Draw
build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15

ghc-options: -O2 -Wall -threaded -rtsopts
Expand All @@ -105,6 +111,7 @@ executable brillo-dropfiles
build-depends:
, base >=4.8 && <5
, brillo >=1.13.3 && <1.15
, text >=2.1.2 && <2.2

ghc-options: -O2 -Wall -threaded -rtsopts

Expand All @@ -114,6 +121,7 @@ executable brillo-easy
hs-source-dirs: picture/Easy
build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15

ghc-options: -O2 -Wall -threaded -rtsopts
Expand All @@ -129,6 +137,7 @@ executable brillo-eden

build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15
, random >=1.2 && <1.3

Expand All @@ -140,6 +149,7 @@ executable brillo-flake
hs-source-dirs: picture/Flake
build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15

ghc-options: -O2 -Wall -threaded -rtsopts
Expand All @@ -150,6 +160,7 @@ executable brillo-gameevent
hs-source-dirs: picture/GameEvent
build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15

ghc-options: -O2 -Wall -threaded -rtsopts
Expand All @@ -160,6 +171,7 @@ executable brillo-hello
hs-source-dirs: picture/Hello
build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15

ghc-options: -O2 -Wall -threaded -rtsopts
Expand All @@ -175,6 +187,7 @@ executable brillo-lifespan

build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15
, random >=1.2 && <1.3

Expand All @@ -196,6 +209,7 @@ executable brillo-machina
hs-source-dirs: picture/Machina
build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15

ghc-options: -O2 -Wall -threaded -rtsopts
Expand All @@ -212,6 +226,7 @@ executable brillo-occlusion

build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15
, brillo-algorithms >=1.13.3 && <1.15

Expand All @@ -224,6 +239,7 @@ executable brillo-pickfiles
build-depends:
, base >=4.8 && <5
, brillo >=1.13.3 && <1.15
, text >=2.1.2 && <2.2

ghc-options: -O2 -Wall -threaded -rtsopts

Expand All @@ -242,6 +258,7 @@ executable brillo-styrene

build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15
, containers >=0.5 && <0.8

Expand All @@ -253,6 +270,7 @@ executable brillo-tree
hs-source-dirs: picture/Tree
build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15

ghc-options: -O2 -Wall -threaded -rtsopts
Expand All @@ -271,6 +289,7 @@ executable brillo-visibility

build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15
, vector >=0.13 && <0.14

Expand All @@ -282,6 +301,7 @@ executable brillo-zen
hs-source-dirs: picture/Zen
build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15

ghc-options: -O2 -Wall -threaded -rtsopts
Expand All @@ -295,6 +315,7 @@ executable brillo-graph
, brillo >=1.13.3 && <1.15
, containers >=0.5 && <0.8
, random >=1.2 && <1.3
, text >=2.1.2 && <2.2

ghc-options: -O2 -Wall -threaded -rtsopts

Expand All @@ -313,6 +334,7 @@ executable brillo-render
default-language: GHC2021
build-depends:
, base >=4.8 && <5
, text >=2.1.2 && <2.2
, brillo >=1.13.3 && <1.15
, brillo-rendering >=1.13.3 && <1.15
, GLFW-b >=3.3 && <4
Expand Down
3 changes: 2 additions & 1 deletion brillo-examples/picture/Bitmap/Main.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Main where

import Brillo
import Data.Text qualified as T
import System.Environment


Expand All @@ -27,7 +28,7 @@ run fileName =

let (width, height) = bitmapSize bmpData
animate
(InWindow fileName (width, height) (10, 10))
(InWindow (T.pack fileName) (width, height) (10, 10))
black
(frame width height picture)

Expand Down
2 changes: 2 additions & 0 deletions brillo-examples/picture/Boids/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

-- Implementation of the Boids flocking algorithm.
-- by Matthew Sottile <[email protected]> <[email protected]>
-- Described in http://syntacticsalt.com/2011/03/10/functional-flocks/
Expand Down
5 changes: 4 additions & 1 deletion brillo-examples/picture/Clock/Main.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{-# LANGUAGE OverloadedStrings #-}

-- A fractal consisting of circles and lines which looks a bit like
-- the workings of a clock.
module Main where

import Brillo
import Data.Text qualified as T
import Prelude hiding (lines)


Expand Down Expand Up @@ -65,7 +68,7 @@ clockFractal n s = Pictures [circ1, circ2, circ3, lines]
Color cyan $
Translate (-0.15) 1 $
Scale 0.001 0.001 $
Text (show s)
Text (T.show s)
else Blank
]

Expand Down
1 change: 1 addition & 0 deletions brillo-examples/picture/Color/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ParallelListComp #-}

-- Draw a color wheel.
Expand Down
2 changes: 2 additions & 0 deletions brillo-examples/picture/Conway/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

module Main where

import Brillo
Expand Down
1 change: 1 addition & 0 deletions brillo-examples/picture/Draw/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternGuards #-}

{-| Simple picture drawing application.
Expand Down
6 changes: 4 additions & 2 deletions brillo-examples/picture/DropFiles/Main.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{-# LANGUAGE OverloadedStrings #-}

-- | Drag & drop files onto the window to load them
module Main where

import Brillo
import Brillo.Interface.Pure.Game
import Data.Function ((&))
import Data.Functor ((<&>))

import Data.Text qualified as T

width :: (Num a) => a
width = 600
Expand All @@ -27,7 +29,7 @@ makePicture (State filePaths) =
filePaths & zip [(1 :: Int) ..] <&> \(i, filePath) ->
Translate (-width / 2) (fromIntegral (-25 * i) + (height / 2)) $
Scale 0.1 0.1 $
Text filePath
Text $ T.pack filePath


-- | Handle drag & drop events
Expand Down
2 changes: 2 additions & 0 deletions brillo-examples/picture/Easy/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

module Main where

import Brillo
Expand Down
2 changes: 2 additions & 0 deletions brillo-examples/picture/Eden/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

-- Adapted from ANUPlot version by Clem Baker-Finch
module Main where

Expand Down
2 changes: 2 additions & 0 deletions brillo-examples/picture/Flake/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

{-| Snowflake Fractal.
Based on ANUPlot code by Clem Baker-Finch.
-}
Expand Down
5 changes: 4 additions & 1 deletion brillo-examples/picture/GameEvent/Main.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{-# LANGUAGE OverloadedStrings #-}

module Main where

import Brillo
import Data.Text qualified as T


-- | Display the last event received as text.
Expand All @@ -12,5 +15,5 @@ main =
100
""
(\str -> Translate (-340) 0 $ Scale 0.1 0.1 $ Text str)
(\event _ -> show event)
(\event _ -> T.show event)
(\_ world -> world)
2 changes: 2 additions & 0 deletions brillo-examples/picture/Graph/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

-- See <http://mazzo.li/posts/graph-drawing.html> for a lengthy
-- explanation about this code.
import Data.Map.Strict (Map)
Expand Down
2 changes: 2 additions & 0 deletions brillo-examples/picture/Hello/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

-- | Display "Hello World" in a window.
module Main where

Expand Down
2 changes: 2 additions & 0 deletions brillo-examples/picture/Lifespan/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

-- Adapted from ANUPlot version by Clem Baker-Finch
module Main where

Expand Down
2 changes: 2 additions & 0 deletions brillo-examples/picture/Lines/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

module Main where

import Brillo (
Expand Down
2 changes: 2 additions & 0 deletions brillo-examples/picture/Machina/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

module Main where

import Brillo
Expand Down
1 change: 1 addition & 0 deletions brillo-examples/picture/Occlusion/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternGuards #-}

import Brillo.Data.Extent
Expand Down
6 changes: 4 additions & 2 deletions brillo-examples/picture/PickFiles/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import Brillo.Interface.IO.Game (
)
import Data.Function ((&))
import Data.Functor ((<&>))
import Data.Text (Text)
import Data.Text qualified as T


size :: (Num width, Num height) => (width, height)
Expand All @@ -28,7 +30,7 @@ size = (600, 600)
data State
= NotAsked
| Success [FilePath]
| Failure String
| Failure Text


moveToTopLeftWithOffset :: Float -> Picture -> Picture
Expand Down Expand Up @@ -66,7 +68,7 @@ makePicture state =
moveToTopLeftWithOffset 0 $
Translate 10 (fromIntegral (-(25 * i))) $
Scale 0.1 0.1 $
ThickText filePath 2
ThickText (T.pack filePath) 2


handleEvent :: Event -> State -> IO State
Expand Down
2 changes: 2 additions & 0 deletions brillo-examples/picture/Styrene/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

module Main where

import Actor (Actor (..))
Expand Down
2 changes: 2 additions & 0 deletions brillo-examples/picture/Tree/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

{-| Tree Fractal.
Based on ANUPlot code by Clem Baker-Finch.
-}
Expand Down
2 changes: 2 additions & 0 deletions brillo-examples/picture/Visibility/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

{-| Visibility on the 2D plane.
Uses an instance of Warnocks algorithm.
TODO: animate the line segments, make them spin and move around so we can see
Expand Down
2 changes: 2 additions & 0 deletions brillo-examples/picture/Zen/Main.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

-- A nifty animated fractal of a tree, superimposed on a background
-- of three red rectangles.
import Brillo
Expand Down
2 changes: 2 additions & 0 deletions brillo-juicy/brillo-juicy.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

module Main where

import Brillo (
Expand Down
Loading

0 comments on commit a7e6937

Please sign in to comment.