aboutsummaryrefslogtreecommitdiff
path: root/plug/src/Montis/Core.hs
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2026-01-01 21:56:35 -0700
committerJosh Rahm <joshuarahm@gmail.com>2026-01-01 21:56:35 -0700
commit1df0b552f17f15942a350def6736d5535e545d4c (patch)
treec10cf5d5da8a241147c62339d4aeaff04eb0352a /plug/src/Montis/Core.hs
parent4c5a5cc0eb92319719773e382fb43d5cb4098b13 (diff)
downloadmontis-1df0b552f17f15942a350def6736d5535e545d4c.tar.gz
montis-1df0b552f17f15942a350def6736d5535e545d4c.tar.bz2
montis-1df0b552f17f15942a350def6736d5535e545d4c.zip
[refactor] Run ormolu on all the source.
Diffstat (limited to 'plug/src/Montis/Core.hs')
-rw-r--r--plug/src/Montis/Core.hs47
1 files changed, 24 insertions, 23 deletions
diff --git a/plug/src/Montis/Core.hs b/plug/src/Montis/Core.hs
index a5479dc..24d7f12 100644
--- a/plug/src/Montis/Core.hs
+++ b/plug/src/Montis/Core.hs
@@ -1,5 +1,7 @@
{-# OPTIONS_GHC -Wno-missing-export-lists #-}
-module Montis.Core
+
+module Montis.Core where
+
-- ( WState (..),
-- WConfig (..),
-- SurfaceState (..),
@@ -18,7 +20,6 @@ module Montis.Core
-- KeyEvent (..),
-- KeyState (..),
-- )
-where
-- import Control.Arrow (first)
-- import Control.Exception
@@ -32,35 +33,35 @@ where
-- import qualified Data.ByteString.Char8 as CH
-- import qualified Data.Map as Map
-- import qualified Montis.Foreign.ForeignInterface as ForeignInterface
---
+--
-- data WContext = WContext
-- { ctxForeignInterface :: ForeignInterface,
-- ctxConfig :: WConfig
-- }
---
+--
-- -- This is the OpaqueState passed to the harness.
-- type Montis = StablePtr (WContext, WState)
---
+--
-- requestHotReload :: W ()
-- requestHotReload = do
-- fi <- ctxForeignInterface <$> getWContext
-- wio $ ForeignInterface.requestHotReload fi
---
+--
-- requestLog :: String -> W ()
-- requestLog str = do
-- fi <- ctxForeignInterface <$> getWContext
-- wio $ ForeignInterface.requestLog fi str
---
+--
-- requestExit :: Int -> W ()
-- requestExit ec = do
-- fi <- ctxForeignInterface <$> getWContext
-- wio $ ForeignInterface.requestExit fi ec
---
+--
-- initMontis :: WConfig -> IO Montis
-- initMontis conf = do
-- foreignInterface <- ForeignInterface.getForeignInterface
-- newStablePtr (WContext foreignInterface conf, WState "this is a string" 0)
---
+--
-- defaultBindings :: Map (KeyState, Word32, Word32) (W ())
-- defaultBindings =
-- Map.fromList
@@ -79,13 +80,13 @@ where
-- ]
-- where
-- sym = fromIntegral . ord
---
+--
-- defaultConfig :: WConfig
-- defaultConfig =
-- WConfig
-- { keybindingHandler = \keyEvent -> do
-- seatPtr <- (wio . ForeignInterface.getSeat . ctxForeignInterface) =<< getWContext
---
+--
-- maybe
-- ( wio $ do
-- wlrSeatSetKeyboard seatPtr (device keyEvent)
@@ -97,7 +98,7 @@ where
-- KeyReleased -> 0
-- _ -> 1
-- )
---
+--
-- return True
-- )
-- (fmap (const True))
@@ -106,7 +107,7 @@ where
-- defaultBindings,
-- surfaceHandler = \state surface -> wio (printf "Surface %s is %s\n" (show surface) (show state))
-- }
---
+--
-- readWState :: ByteString -> IO WState
-- readWState bs =
-- catch
@@ -114,38 +115,38 @@ where
-- ( \e ->
-- let _ = (e :: SomeException) in return (WState "" 0)
-- )
---
+--
-- newtype W a = W ((WContext, WState) -> IO (a, WState))
---
+--
-- instance Functor W where
-- fmap mfn (W fn) = W $ fmap (first mfn) <$> fn
---
+--
-- instance Applicative W where
-- pure a = W $ \(_, s) -> return (a, s)
-- mfn <*> ma = do
-- fn <- mfn
-- fn <$> ma
---
+--
-- instance Monad W where
-- (W fntoa) >>= fnmb = W $ \(config, state) -> do
-- (a, state') <- fntoa (config, state)
-- let W fntob = fnmb a
-- fntob (config, state')
---
+--
-- getWContext :: W WContext
-- getWContext = W pure
---
+--
-- getWConfig :: W WConfig
-- getWConfig = ctxConfig <$> getWContext
---
+--
-- getWState :: W WState
-- getWState = W $ \(_, s) -> pure (s, s)
---
+--
-- runW :: W a -> (WContext, WState) -> IO (a, WState)
-- runW (W fn) = fn
---
+--
-- incrementState :: W Int
-- incrementState = W $ \(_, WState s i) -> return (i, WState s (i + 1))
---
+--
-- wio :: IO a -> W a
-- wio fn = W $ \(_, b) -> fn >>= \a -> return (a, b)