Skip to content

Instantly share code, notes, and snippets.

🤓

Dimitri Sabadie phaazon

🤓
Block or report user

Report or block phaazon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Selective.hs
-- Why not this implementation?
selectM :: (Monad f) => f (Either a b) -> f (a -> b) -> f b
selectM x y = do
e <- x
case e of
Left a -> fmap ($a) y
Right b -> b <$ y
View Selective.hs
-- Why not this implementation?
selectM :: (Monad f) => f (Either a b) -> f (a -> b) -> f b
selectM x y = do
e <- x
case e of
Left a -> fmap ($a) y
Right b -> fmap (const b) y
View a.cpp
#include <iostream>
#include <string>
struct BordelLand {
BordelLand(bool x): tag(Graffiti::A), a(x) {}
BordelLand(char x): tag(Graffiti::B), b(x) {}
BordelLand(float x): tag(Graffiti::C), c(x) {}
template <typename F> void pattern_a(F f) {
if (tag == Graffiti::A) {
View custom_deserialize_serde.rs
use serde::de::{Deserialize, Deserializer, Error, Visitor};
use std::fmt;
use serde_json::de::from_str;
#[derive(Clone, Debug, Eq, PartialEq)]
enum YourFancyEnum {
Foo,
Bar,
Zoo,
View keybase.md

Keybase proof

I hereby claim:

  • I am phaazon on github.
  • I am phaazon (https://keybase.io/phaazon) on keybase.
  • I have a public key whose fingerprint is 3943 DF2A 2E41 24B4 5702 E6BC 4F28 29BB 996A 2EED

To claim this, I am signing this object:

View NT.hs
{-# LANGUAGE RankNTypes #-}
-- A natural transformation.
data NT f g = NT { nt :: forall a. f a -> g a }
-- Natural transformation from Maybe to [].
maybeListNT :: NT Maybe []
maybeListNT = NT (maybe [] pure)
View a.rs
fn correct<F>(f: F) where F: for<'a> FnOnce(&'a u32) {
f(&3)
}
fn dafuck<F>(f: F) where for<'a> F: FnOnce(&'a u32) {
f(&3)
}
fn main() {
correct(|x| println!("{}", x));
View enkuler_de_rire.go
package main
import "fmt"
func fibonacci() func() int {
a := 0
b := 1
return func() int {
c := a
a, b = b, a + b
@phaazon
phaazon / main.rs
Last active Sep 14, 2017
lumitest
View main.rs
extern crate luminance;
extern crate luminance_glfw;
use luminance::framebuffer::Framebuffer;
use luminance::pipeline::{entry, pipeline};
use luminance::shader::program::{Program, ProgramError, Uniform, UniformBuilder, UniformInterface, UniformWarning};
use luminance::tess::{Mode, Tess, TessVertices};
use luminance_glfw::{Action, Device, Key, WindowDim, WindowOpt, WindowEvent};
use std::time::Instant;
View dangling_ref_closure_no_move_capture.cpp
// g++ main.cpp -std=c++17 -W -Wall -pedantic
#include <cstdlib>
#include <cstdint>
#include <functional>
auto foo() -> std::function<void ()> {
int32_t a = 317;
return [&a]() {
You can’t perform that action at this time.