garnet/exe/Main.hs

21 lines
668 B
Haskell
Raw Permalink Normal View History

2026-02-17 14:57:34 +00:00
module Main (main) where
2026-03-25 01:09:10 +00:00
import Data.Vector.Storable qualified as V
2026-02-19 13:44:16 +00:00
import GarnetRs.Wrapped
2026-03-25 01:57:56 +00:00
import System.IO
2026-02-17 14:57:34 +00:00
main :: IO ()
main = do
2026-02-19 13:44:16 +00:00
hello "Haskell"
helloStruct T{a = True, b = 42}
helloStruct T{a = False, b = maxBound}
2026-04-14 00:42:17 +01:00
helloEnum E1
helloEnum E3
2026-02-19 13:44:16 +00:00
helloShape $ Circle 3.14
helloShape $ Rectangle 10.0 5.0
2026-02-19 15:56:55 +00:00
putStrLn $ "3 + 4 = " <> show (add 3 4)
2026-02-19 21:35:35 +00:00
putStrLn $ "Tree sum: " <> show (sumTree (Fork (Fork (Leaf 1) (Fork (Leaf 2) (Leaf 3))) (Leaf 4)))
2026-03-25 01:09:10 +00:00
putStrLn $ "Slice sum: " <> show (sumSlice $ V.fromList [0 .. 5])
2026-03-25 01:57:56 +00:00
putStrLn "Nothing." >> printOptional Nothing
putStr "Something: " >> hFlush stdout >> printOptional (Just 67)