Skip to content

Instantly share code, notes, and snippets.

@Cedev
Cedev / prfCompiler.hs
Created January 11, 2015 05:47
Compiler from ArrowLike primitive recursive functions to LLVM
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ConstraintKinds #-}
@Cedev
Cedev / LLVM_General_Pure_PrettyPrint.hs
Created January 11, 2015 05:44
pretty print LLVM in in pure haskell (large unimplemented sections)
{-
Copyright (c) 2014 Stephen Diehl
Copyright (c) 2015 Cedric Shock
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
@Cedev
Cedev / lazyUnfoldTree3-nomfix-delayed.hs
Created January 6, 2015 18:35
General lazy tree unfold with no MonadFix and delayed path compression
import Data.Tree hiding (unfoldTreeM_BF, unfoldForestM_BF)
import Data.Traversable
import Prelude hiding (sequence)
import Control.Monad.Free
import Data.Functor.Identity
unfoldTreeM_BF :: Monad m => (b->m (a, [b])) -> b -> m (Tree a)
import Data.Array
import Data.Maybe
import Data.Ord
import Data.Foldable (toList)
import Data.Char
import Data.List
type Sudoku = Array Pos (Maybe Color)
type Pos = (Int, Int)
type Color = Int
{-# LANGUAGE DefaultSignatures, DeriveGeneric, TypeOperators, FlexibleContexts, StandaloneDeriving, ScopedTypeVariables, FlexibleInstances, DeriveFunctor, DeriveFoldable, DeriveTraversable #-}
module Main (
main
) where
import Data.Text (Text)
import qualified Data.Map as Map
import Data.Foldable (Foldable)