Loading package.yaml +9 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,15 @@ description: Please see the README at <https://git.eisfunke.com/software dependencies: - base - text - network - bytestring - connection - JuicyPixels default-extensions: #- NoImplicitPrelude - OverloadedStrings #- LambdaCase #- RecordWildCards library: source-dirs: src Loading src/Main.hs +26 −1 Original line number Diff line number Diff line module Main where import qualified Data.ByteString as B import qualified Data.Text as T import qualified Data.Text.Encoding as T import Text.Printf import Network.Connection import Codec.Picture main :: IO () main = do putStrLn "Hello World!" ctx <- initConnectionContext con <- connectTo ctx $ ConnectionParams { connectionHostname = "localhost" , connectionPort = 1337 , connectionUseSecure = Nothing , connectionUseSocks = Nothing } connectionPut con (T.encodeUtf8 "PX 20 20 ff0000\n") connectionClose con data Pixel = Pixel { pixelX :: Int, pixelY :: Int, pixelColor :: PixelRGB8 } yeet :: Connection -> Int -> Int -> PixelRGB8 -> IO () yeet con x y (PixelRGB8 r g b) = connectionPut con $ T.encodeUtf8 $ printf "PX %d %d %02x%02x%02x\n" x y r g b Loading
package.yaml +9 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,15 @@ description: Please see the README at <https://git.eisfunke.com/software dependencies: - base - text - network - bytestring - connection - JuicyPixels default-extensions: #- NoImplicitPrelude - OverloadedStrings #- LambdaCase #- RecordWildCards library: source-dirs: src Loading
src/Main.hs +26 −1 Original line number Diff line number Diff line module Main where import qualified Data.ByteString as B import qualified Data.Text as T import qualified Data.Text.Encoding as T import Text.Printf import Network.Connection import Codec.Picture main :: IO () main = do putStrLn "Hello World!" ctx <- initConnectionContext con <- connectTo ctx $ ConnectionParams { connectionHostname = "localhost" , connectionPort = 1337 , connectionUseSecure = Nothing , connectionUseSocks = Nothing } connectionPut con (T.encodeUtf8 "PX 20 20 ff0000\n") connectionClose con data Pixel = Pixel { pixelX :: Int, pixelY :: Int, pixelColor :: PixelRGB8 } yeet :: Connection -> Int -> Int -> PixelRGB8 -> IO () yeet con x y (PixelRGB8 r g b) = connectionPut con $ T.encodeUtf8 $ printf "PX %d %d %02x%02x%02x\n" x y r g b