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 FlexibleContexts #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE RebindableSyntax #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
module GIf where | |
import Data.Kind | |
import GHC.Generics | |
import Prelude |
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
module Main where | |
newtype IODouble = IODouble { runIODouble :: IO Double } | |
instance Num IODouble where | |
fromInteger x = IODouble $ do | |
print x | |
pure $ fromInteger x | |
(IODouble x) + (IODouble y) = IODouble $ do | |
x' <- x |
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
.intel_syntax noprefix | |
.text | |
not: | |
ret | |
f: | |
call not | |
ret | |
# 以下ログ | |
# Stack dump: |
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
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <gc.h> | |
#include <stdint.h> | |
struct value; | |
struct env | |
{ |
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
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <gc.h> | |
union value; | |
struct env; | |
struct closure; | |
union value; |
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
const Discord = require('discord.js'); | |
function getRandomInt(min, max) { | |
min = Math.ceil(min); | |
max = Math.floor(max); | |
return Math.floor(Math.random() * (max - min)) + min; //The maximum is exclusive and the minimum is inclusive | |
} | |
function diceRoll(count, roll) { | |
let dices = []; |
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
#include <iostream> | |
#include <tuple> | |
#include <algorithm> | |
#include <vector> | |
using namespace std; | |
template <typename T> | |
unsigned int digit_sum(T x, unsigned int base) { | |
auto result = 0; |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define MAX_LEN 256 | |
typedef struct stack { | |
int *stack; | |
int len; | |
} Stack; |
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
module AstDsl where | |
import Control.Monad.State | |
import Control.Monad.Identity | |
import Data.Monoid | |
import Control.Monad.Writer | |
-- こんな普通のAST定義があるとする | |
data Expr = Let String Expr Expr | |
| Var String |