Skip to content

Instantly share code, notes, and snippets.

View christiaanb's full-sized avatar

Christiaan Baaij christiaanb

  • QBayLogic
  • Enschede, The Netherlands
View GitHub Profile
interface addOne_i;
task automatic run (input integer a, output integer b);
b = a + 1;
endtask
endinterface
interface map_i #( parameter N=32, parameter type ELEMTYPE=logic )
( interface f );
task automatic run ( input ELEMTYPE arg [N-1:0]
, output ELEMTYPE res [N-1:0]);
{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable,
ScopedTypeVariables, OverloadedStrings, TypeSynonymInstances,
FlexibleInstances, GADTs #-}
module Core where
import Bound
import Bound.Name
import Bound.Var
import Control.Applicative
import Control.Comonad
@christiaanb
christiaanb / LambdaPi.hs
Last active August 29, 2015 14:01
LambdaPi.hs
-- http://www.andres-loeh.de/LambdaPi/
module LambaPi where
data TermI
= Ann TermC TermC
| Star
| Pi TermC TermC
| Bound Int
| Free Name
| TermI :@: TermC
This file has been truncated, but you can view the full file.
*Signal> fails
Just 2 ::
Nothing ::
take 1
(Stream instance of Prelude.Functor.Functor, method map snd
(zipWith apply
(zipWith apply
(calc ::
Delay (repeat calc))
(map fst
{-# LANGUAGE DeriveFoldable, DeriveFunctor, DeriveTraversable #-}
module SimpleCore where
import Bound
import Bound.Name
import Bound.Var
import Control.Applicative
import Control.Comonad
import Control.Monad
import Data.Bifunctor
/opt/ghc/7.8.3$ make
cd ./src/ghc-7.8.3 && ./configure --prefix=/opt/ghc/7.8.3 && make install
checking for path to top of build tree... /opt/ghc/7.8.3/src/ghc-7.8.3
Build platform inferred as: x86_64-apple-darwin
Host platform inferred as: x86_64-apple-darwin
Target platform inferred as: x86_64-apple-darwin
GHC build : x86_64-apple-darwin
GHC host : x86_64-apple-darwin
GHC target : x86_64-apple-darwin
checking for perl... /usr/bin/perl
@christiaanb
christiaanb / DepLamInfer.hs
Last active August 29, 2015 14:03
Type Inference for a small dependently typed language
{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable,
ScopedTypeVariables #-}
{- |
Usage:
>>> inferType1 (const undefined) dollar
>>> inferType2 (const undefined) dollar
>>> inferType3 (const undefined) dollar
>>> inferType4 (const undefined) id dollar
-}
module DepLamInfer where
{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-}
{-# OPTIONS_GHC -fno-full-laziness #-}
module Main where
import Bound
import Bound.Name
import Bound.Var
import Control.Applicative
import Control.Comonad
import Control.Monad
module CLaSH.Signal.Enabled.SCase where
import Data.Default
import Language.Haskell.TH
scase e = do
e' <- e
case e' of
CaseE e2 ms -> do
nm1 <- newName "eb"
{-# LANGUAGE Arrows, GADTs, TypeFamilies, NoImplicitPrelude, RankNTypes #-}
module ArrTest where
import Unsafe.Coerce
import CLaSH.Prelude hiding (id,(.))
import Control.Arrow
import Control.Category
import Data.Proxy
type family En a