Skip to content

Instantly share code, notes, and snippets.

View crockeea's full-sized avatar

crockeea

  • Amazon Web Services, Inc.
  • Seattle, WA
View GitHub Profile
@crockeea
crockeea / Foo.hs
Last active August 29, 2015 14:01
An example of where I need an explicit `Typeable ExprTypes a` constraint
{-# LANGUAGE ScopedTypeVariables,
TypeOperators,
DataKinds,
KindSignatures,
TypeFamilies,
GADTs,
FlexibleContexts,
FlexibleInstances,
MultiParamTypeClasses #-}
@crockeea
crockeea / Main.hs
Last active August 29, 2015 14:01
An example of how to share ASTs with syntactic-2.0
{-# LANGUAGE GADTs, TypeOperators, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts #-}
import Data.Syntactic
import Data.Syntactic.Functional hiding (eval)
import Data.Syntactic.TypeUniverse
import Data.Syntactic.Sugar.BindingT ()
data Let a where
Let :: Let (a :-> (a -> b) :-> Full b)
@crockeea
crockeea / gist:07ea03c24aaea3efec81
Created June 5, 2014 14:12
Example showing the need for typeable instances
{-# LANGUAGE TypeOperators, GADTs, FlexibleContexts, AllowAmbiguousTypes, StandaloneDeriving, DeriveDataTypeable #-}
import Data.Typeable
import Data.Syntactic
import Data.Syntactic.Functional
import Data.Syntactic.Sugar.BindingT ()
deriving instance Typeable Construct
deriving instance Typeable BindingT
deriving instance Typeable AST