This file contains hidden or 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 OverloadedStrings #-} | |
| {-# LANGUAGE ViewPatterns #-} | |
| import System.Process | |
| import qualified Data.Text as Text | |
| import qualified Data.Text.IO as Text | |
| import Data.Foldable (for_) | |
| import Data.Char (isLower) | |
| import Control.Monad (when) | |
| import Control.Applicative ((<|>)) |
This file contains hidden or 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 OverloadedStrings #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| import Data.Word | |
| data family Address arch | |
| type family InterpreterState arch | |
| type family State arch :: (* -> *) -> * | |
| data instance Address Int = AddressInt Int | |
| data instance Address Char = AddressChar Word8 Word8 Word8 Word8 |
This file contains hidden or 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
| Inductive Nat := | |
| Z : Nat | |
| | S : Nat -> Nat. | |
| (* This version of Add is not tail recursive *) | |
| Fixpoint Add a b := | |
| match a with | |
| | Z => b | |
| | S n => S (Add n b) | |
| end. |
This file contains hidden or 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 TypeApplications #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE FunctionalDependencies #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE AllowAmbiguousTypes #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| f :: Num a => a -> a -> a | |
| f x y = x * y |
This file contains hidden or 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 subprocess | |
| import time | |
| import sys | |
| import os | |
| # Start xephyr | |
| xephyr = subprocess.Popen( | |
| "Xephyr -br -ac -noreset -screen 1920x1080 -dpi 300 :1".split() | |
| ) |
This file contains hidden or 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 DataKinds #-} | |
| {-# LANGUAGE ExplicitForAll #-} | |
| {-# LANGUAGE GADTs #-} | |
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {-# LANGUAGE TypeApplications #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| {-# LANGUAGE AllowAmbiguousTypes #-} |
This file contains hidden or 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 DataKinds #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE FunctionalDependencies #-} | |
| {-# LANGUAGE KindSignatures #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE PatternSynonyms #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| module Algebra | |
| ( pattern P, |
This file contains hidden or 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
| licensesIn = acc: p: { | |
| res = if builtins.isAttrs p && builtins.hasAttr "meta" p then | |
| pkgs.lib.unique (acc.res ++ [{ | |
| package = p.pname or p.name or "N/A"; | |
| version = p.version or "N/A"; | |
| url = p.meta.homepage or "N/A"; | |
| licenses = (if builtins.isList (p.meta.license or "oops") then | |
| map (l: l.spdxId) p.meta.license | |
| else | |
| [ p.meta.license.spdxId or "N/A" ]); |
This file contains hidden or 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 FlexibleContexts #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE FunctionalDependencies #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE UndecidableInstances #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| import GHC.Float | |
| class RealToFrac a where | |
| convert :: a -> Double |
This file contains hidden or 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 -Wall #-} | |
| queueTime :: [Int] -> Int -> Int | |
| queueTime l n = go (take n l) (drop n l) 0 | |
| where | |
| go [] [] res = res | |
| go workers remains res = let | |
| faster = minimum workers | |
| workers' = filter(/= 0) $ map (subtract faster) workers | |
| l' = workers' ++ remains |