Skip to content

Instantly share code, notes, and snippets.

🍥
bottomless pit

Francesco Mazzoli bitonic

🍥
bottomless pit
Block or report user

Report or block bitonic

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
@bitonic
bitonic / readme.txt
Created Dec 24, 2018
My Game (PuzzleScript Script)
View readme.txt
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@bitonic
bitonic / readme.txt
Created Dec 13, 2018
Simple Block Pushing Game (PuzzleScript Script)
View readme.txt
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
View conversion.hs
import GHC.Generics
import Data.Kind
import qualified Data.Vector as V
import qualified Data.HashMap.Strict as HMS
import qualified Data.Map.Strict as Map
import Data.Hashable (Hashable)
type family WebApiType a :: *
View tuples.hs
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE GADTs #-}
module Test where
View keybase.md

Keybase proof

I hereby claim:

  • I am bitonic on github.
  • I am bitonic (https://keybase.io/bitonic) on keybase.
  • I have a public key whose fingerprint is 81AE B4F4 45B7 79AD F92E 0872 F59F FEA3 BBE1 A8C8

To claim this, I am signing this object:

View unboxed-polymorphic.md

Macro types

I very often find myself wanting unboxed polymorphic types (e.g. types that contain UNPACKed type variables). I find it extremely frustrating that it's easier to write fast and generic code in C++ than in Haskell.

I'd like to submit to the mailing list a very rough proposal on how this could be achieved in a pretty straightforward way in GHC.

View OrdNub.hs
{-# LANGUAGE BangPatterns #-}
module OrdNub (ordNub) where
import Prelude hiding (null)
-- See Note: Order of constructors
data Set a = Bin {-# UNPACK #-} !Size !a !(Set a) !(Set a)
| Tip
type Size = Int
View crc32.hs
import Control.Exception (evaluate)
import Control.Monad (forM_)
import Control.Monad (replicateM, forM)
import qualified Data.ByteString.Lazy as BS
import qualified Data.Digest.CRC32
import qualified Data.Digest.Pure.CRC32
import System.Environment (getArgs)
import qualified System.Random.MWC as MWC
import Data.Binary (encodeFile, decodeFile)
import Data.Word (Word32)
@bitonic
bitonic / gist:627fb9c1a5d494372d1d
Created Apr 14, 2015
loop video into v4l2loopback device
View gist:627fb9c1a5d494372d1d
#include <gst/gst.h>
#include <glib.h>
typedef struct {
GMainLoop* loop;
GstElement* pipeline;
} LoopAndPipeline;
static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data)
{
View Makefile
# Makefile tweaked for Ubuntu 14.04, install gnustep and gnustep-devel first.
HC = ghc
LIBDIR = $(shell $(HC) --print-libdir)
CFLAGS = -fobjc-arc -I$(LIBDIR)/include -I$(LIBDIR)/../../includes
HCFLAGS =
LDFLAGS = -package template-haskell -package language-c-quote -package language-c-inline -L/usr/lib/GNUstep/System/Library/Libraries/ -lgnustep-base -lobjc
OBJS = Main.o Main_objc.o
You can’t perform that action at this time.