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
data Config = Config { x :: Int, y :: Int } | |
defaultConfig :: Config | |
data Options' a = OptionsA { queue :: Text } | |
| OptionsB { config :: a, queue :: Text, a :: Text, b :: Maybe Int } | |
| OptionsC { config :: a, queue :: Text, c :: Int, d :: Word8 } | |
| OptionsD { config :: a, queue :: Text, c :: [Word8], d :: Bool } | |
using Options1 = Options' (Maybe Text) | |
using Options2 = Options' Config |
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
--Works, but verbose: | |
let lineParser' = do | |
[email protected]{[email protected]{ | |
[email protected]{sourceLine, sourceColumn}}} <- getParserState | |
let pstateSourcePos' :: MP.SourcePos | |
pstateSourcePos' = pstateSourcePos{sourceLine = mkPos lineNo, sourceColumn = mkPos 1} | |
setParserState parserState{statePosState=statePosState{pstateSourcePos=pstateSourcePos'}} | |
lineParser | |
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 System.Taffybar | |
import System.Taffybar.Context (TaffybarConfig(..)) | |
import System.Taffybar.Hooks | |
import System.Taffybar.SimpleConfig | |
import System.Taffybar.Widget | |
config :: TaffybarConfig | |
config = | |
let myWorkspacesConfig = | |
defaultWorkspacesConfig |
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 Data.Map as M | |
import XMonad | |
import XMonad.Config.Desktop (desktopConfig) | |
import XMonad.Hooks.DynamicLog | |
import XMonad.Hooks.ManageDocks | |
import qualified XMonad.StackSet as W | |
import XMonad.Util.Run(spawnPipe) | |
import XMonad.Util.EZConfig(additionalKeys) | |
import System.IO | |
import System.Exit (exitSuccess) |
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
{-# LANGUAGE RecordWildCards, DuplicateRecordFields #-} | |
import ClassyPrelude hiding (try) | |
import Control.Monad.Except (MonadError, throwError) | |
import Control.Monad.State.Strict | |
import Control.Monad.Trans.Resource (ResourceT, runResourceT) | |
import Data.Conduit (ConduitM, runConduit, (.|)) | |
import Data.Conduit.Combinators (sourceFile) | |
import qualified Data.Conduit.List as CL | |
import Data.Conduit.Lzma (decompress) |
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
179,646,281,792 bytes allocated in the heap | |
15,445,250,464 bytes copied during GC | |
2,808,589,128 bytes maximum residency (24 sample(s)) | |
87,755,112 bytes maximum slop | |
7666 MB total memory in use (0 MB lost due to fragmentation) | |
Tot time (elapsed) Avg pause Max pause | |
Gen 0 170754 colls, 0 par 13.690s 16.086s 0.0001s 1.9563s | |
Gen 1 24 colls, 0 par 0.002s 0.003s 0.0001s 0.0016s |
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
#!/usr/bin/env python3 | |
import numpy as np | |
import keras.layers as kl | |
import tensorflow as tf | |
class_count = 5 | |
width, height = 100, 100 | |
# Placeholders |
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
data Foo = Foo { alpha :: Int, beta :: Int, gamma :: Int | |
, delta :: Int, eta :: Int } deriving (Eq, Ord, Show) | |
plusOn :: Num a => (Foo -> a) -> Foo -> Foo -> a | |
plusOn = on (+) | |
maxOn :: Ord a => (Foo -> a) -> Foo -> Foo -> a | |
maxOn = on max | |
newtype AddFoo = AddFoo { getAddFoo :: Foo } | |
instance Semigroup AddFoo 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
import import Data.Array.Base | |
import Data.ByteString | |
import GHC.Prim | |
type Chunk = UArray Int Word8 | |
-- Is there anything preventing byteArray from being relocated by the garbage collector after it's read but before it's used packCStringLen, so that packCStringLen uses an old, invalid, address? | |
chunkToBs :: Chunk -> ByteString | |
chunkToBs (UArray _ _ n byteArray) = unsafePerformIO $ |
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
newtype CdRoot a = CdRoot (IO a) | |
cdRoot :: CdRoot a -> IO a | |
cdRoot (CdRoot x) = changeWorkingDirectory "/" >> x | |
instance Semigroup a => Semigroup (CdRoot a) where | |
CdRoot x <> CdRoot y = CdRoot $ x <> y | |
-- The constraint ‘Semigroup (CdRoot a)’ is no smaller than the instance head (Use UndecidableInstances to permit this) | |
instance (Semigroup (CdRoot a), Monoid a) => Monoid (CdRoot a) where | |
mempty = CdRoot mempty |