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 DerivingStrategies #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE PatternSynonyms #-} | |
{-# OPTIONS_GHC -Wall #-} | |
module Checkpoint | |
( FreshT (..) | |
, runFreshT |
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
// defining the plugin: | |
use bevy::{prelude::*, tasks::IoTaskPool}; | |
pub struct Parker(parking::Parker); | |
#[derive(Resource)] | |
pub struct Unparker(pub parking::Unparker); | |
fn park_system(parker: NonSend<Parker>) { |
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
use crop::Rope; | |
#[must_use] | |
pub fn prev_grapheme_boundary(rope: &Rope, mut byte_offset: usize) -> Option<usize> { | |
if byte_offset == 0 { | |
return None; | |
} | |
byte_offset -= 1; | |
while !rope.is_grapheme_boundary(byte_offset) { | |
byte_offset -= 1; |
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
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
IFS=$'\n\t' | |
# https://github.com/evanrelf/indigo/tree/rust4 | |
core=$(gum style --border normal "$(fd . --extension rs crates/core/src/ | as-tree --color always)") | |
tui=$(gum style --border normal "$(fd . --extension rs crates/tui/src/ | as-tree --color always)") | |
btree=$(gum style --border normal "$(fd . --extension rs crates/btree/src/ | as-tree --color always)") |
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
#!/usr/bin/env runghc | |
-- ki, unfork, stm | |
{-# LANGUAGE BlockArguments #-} | |
{-# OPTIONS_GHC -Wall #-} | |
{-# OPTIONS_GHC -threaded #-} | |
import Control.Concurrent qualified as Concurrent |
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 #-} | |
{-# OPTIONS_GHC -Wall #-} | |
module X where | |
import Data.Kind (Type) | |
import GHC.TypeLits (KnownSymbol, Symbol) | |
type (:::) :: Symbol -> Type -> Type | |
data (:::) s 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
use serde::{Deserialize, Deserializer, Serialize, Serializer}; | |
use serde_json; | |
#[derive(Debug, Serialize, Deserialize)] | |
struct Foo(String); | |
#[derive(Debug, Serialize, Deserialize)] | |
struct Bar(String); | |
fn foo_ser<S>(value: &Foo, serializer: S) -> Result<S::Ok, S::Error> |
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
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
IFS=$'\n\t' | |
deferred=(true) | |
run_deferred() { | |
local status="$1" | |
abort() { |
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 QualifiedDo #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE OverloadedLabels #-} | |
module X where | |
import Data.Functor.Identity (Identity (..)) | |
import Data.Kind (Type) | |
import GHC.OverloadedLabels (IsLabel (..)) |
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
-- https://www.youtube.com/watch?v=dDtZLm7HIJs | |
{-# LANGUAGE BlockArguments #-} | |
module Main (main) where | |
import Control.Applicative | |
import Control.Monad (when) | |
import Data.Char | |
import Data.Foldable (for_) |
NewerOlder