2.hs 816 B

123456789101112131415161718192021222324
  1. {-# LANGUAGE OverloadedStrings #-}
  2. import Data.List
  3. import System.Random
  4. import Util
  5. import Text.LaTeX
  6. import Text.LaTeX.Base.Class
  7. import Text.LaTeX.Base.Syntax
  8. import Text.LaTeX.Packages.Graphicx
  9. import Text.LaTeX.Packages.Geometry
  10. main :: IO ()
  11. main = do
  12. printdoc $ doc $ mkStdGen 2
  13. doc :: Monad m => StdGen -> LaTeXT_ m
  14. doc g = do
  15. -- original piece written in Float -- conversions made to ensure random order is the same
  16. -- TODO: ensure random floats are cross-platform?
  17. mapM_ block $ zip (fmap realToFrac $ take 12 $ ((randoms g) :: [Float])) (fmap realToFrac $ take 12 $ drop 12 $ ((randoms g) :: [Float]))
  18. textblock' (vw 0.6) (vh 0.95) "at peace"
  19. block (x, y) = textblock' (vw $ x) (vw y) $ texttt $ fromString $ foldr (++) "" $ intersperse " " $ replicate 240 "this is not happening"