This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gdb astroid | |
GNU gdb (GDB) 13.1 | |
Copyright (C) 2023 Free Software Foundation, Inc. | |
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | |
This is free software: you are free to change and redistribute it. | |
There is NO WARRANTY, to the extent permitted by law. | |
Type "show copying" and "show warranty" for details. | |
This GDB was configured as "x86_64-pc-linux-gnu". | |
Type "show configuration" for configuration details. | |
For bug reporting instructions, please see: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# OPTIONS_GHC -fno-warn-orphans #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module Main where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Printf where | |
int :: (String -> a) -> String -> Int -> a | |
int cont str n = cont (str ++ show n) | |
lit :: String -> (String -> a) -> String -> a | |
lit l cont str = cont (str ++ l) | |
str :: (String -> a) -> String -> String -> a | |
str cont str s = cont (str ++ s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cabal install | |
Resolving dependencies... | |
Configuring vimus-0.0.0... | |
Building vimus-0.0.0... | |
Preprocessing executable 'vimus' for vimus-0.0.0... | |
src/Main.hs:1:1: | |
Could not find module `Prelude' | |
It is a member of the hidden package `base'. | |
Perhaps you need to add `base' to the build-depends in your .cabal file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to install Haskell from scratch | |
----------------------------------- | |
- Attention: There is a matching version of GHC for each version of Haskell | |
Platform, make sure you check to install the one matching the Haskell | |
Platform you plan to install | |
- Download binary GHC package from http://www.haskell.org/ghc/ | |
- Unpack, then: | |
$ export VERSION=7.4.1 # adapt | |
$ cd ghc-$VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getMessageState :: State [Message] Message | |
getMessageState [] = undefined | |
The equation(s) for `getMessageState' have one argument, | |
but its type `State [Message] Message' has none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad.State | |
data Message = MsgA | MsgB | |
deriving (Show, Eq) | |
class Monad m => MonadHmud m where | |
getMessage :: m Message | |
instance MonadHmud IO where | |
getMessage = do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Random | |
-- randomEnum :: (Enum a, Bounded a) => IO a | |
randomEnum = do | |
let minBoundInt = fromEnum (minBound::a) | |
let maxBoundInt = fromEnum (maxBound::a) | |
randomInt <- Random.randomRIO (minBoundInt, maxBoundInt) | |
return $ toEnum randomInt | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
updatePid :: H.HashTable Int Window -> Window -> X () | |
updatePid pidhash w = do | |
mpid <- getProp32s "_NET_WM_PID" w | |
pid <- mpid | |
H.update pidhash (fromIntegral $ fromJust pid) w | |
return () |