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
ТЕТРІС 0.0.0.12 | |
Реалізація класичного тетріса (з урізаними можливостями), з виводом у консоль. | |
Урізано: відображення наступної фігури та рахунку | |
клавіша прискореного падіння фігури | |
рівні та зміна швидкостей | |
Код переписано багато разів, з кожним разом він ставав все кращим та кращим. | |
> {-# LANGUAGE TemplateHaskell #-} |
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.Wire | |
import Prelude hiding ((.), id) | |
import System.Console.ANSI | |
import Data.Maybe | |
import Control.Applicative ((<$>)) | |
control whenInhibited whenProduced wire = loop wire clockSession | |
where | |
loop w' session' = do | |
(mx, w, session) <- stepSession w' session' () |
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
type Timer = ( Rational -- ^ start time | |
, Rational) -- ^ interval | |
createTimer :: Rational -- ^ interval | |
-> IO Timer | |
createTimer interval = | |
(\x -> (x, interval)) . toRational . utctDayTime <$> getCurrentTime | |
updateTimer :: Timer -> IO (Timer, Bool) | |
updateTimer (time, interval) = |
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 Arrows #-} | |
import Control.Wire | |
import Prelude hiding ((.), id) | |
import System.Console.ANSI | |
import Data.Maybe | |
import Control.Arrow | |
import Control.Monad.Trans.State | |
import Control.Monad.Trans | |
import Data.Time.Clock |
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 GADTs, DataKinds, KindSignatures #-} | |
import Data.Word | |
import Data.Int | |
import Numeric | |
import Data.Bits | |
import Data.Binary.Put (putWord32le, putWord16le, runPut) | |
import Data.ByteString.Lazy (unpack) | |
import qualified Data.ByteString as B |
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 OverloadedStrings, ScopedTypeVariables #-} | |
import qualified Data.ByteString as BS | |
import qualified Data.ByteString.Char8 as C8 | |
import qualified System.IO.Streams.Combinators as SC | |
import Network.Socket (withSocketsDo) | |
import System.IO.Streams (InputStream, OutputStream, ReadTooShortException) | |
import Network.Http.Client | |
import qualified System.IO.Streams as S | |
import Data.Maybe | |
import Control.Exception (bracket) |
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 ScopedTypeVariables #-} | |
import System.USB | |
import Control.Monad (forM_, when) | |
import Data.Vector (toList, Vector) | |
import Control.Exception | |
import Text.PrettyPrint | |
import Control.Arrow hiding ((<+>)) | |
import qualified Data.ByteString as BS | |
import Numeric |
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
# the system. Help is available in the configuration.nix(5) man page | |
# or the NixOS manual available on virtual console 8 (Alt+F8). | |
{ config, pkgs, ... }: | |
{ | |
require = | |
[ # Include the results of the hardware scan. | |
./hardware-configuration.nix | |
]; |
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.ByteString.Char8 as B | |
import Criterion.Main | |
import Data.IORef | |
import Data.Vector | |
import Data.ByteString.Char8 (ByteString) | |
import Control.Monad (forever) | |
import Pipes | |
import qualified Pipes.Prelude as P | |
import Data.Char (intToDigit) | |
import qualified Data.ByteString.Builder as Builder |
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.USB | |
( InterfaceDesc(interfaceEndpoints, interfaceNumber), | |
EndpointDesc(endpointAddress), | |
DeviceDesc(deviceProductId, deviceVendorId), | |
Device, | |
Ctx, | |
ConfigDesc(configInterfaces), | |
withDeviceHandle, | |
withDetachedKernelDriver, | |
withClaimedInterface, |
OlderNewer