barrucadu / coco Goto Github PK
View Code? Open in Web Editor NEWThe Concurrency Commentator; giving you cheap remarks about concurrent programs.
License: MIT License
The Concurrency Commentator; giving you cheap remarks about concurrent programs.
License: MIT License
I've figured out a nice way to support an arbitrary number of type variables:
> :set -XDataKinds
> :set -XKindSignatures
> import Data.Proxy
> import Data.Typeable
> import GHC.TypeLits
> data TyVar (n :: Nat) = TyVar
> type A = TyVar 0
> let isTypeVar :: Typeable t => Proxy t -> Bool; isTypeVar p = fst (splitTyConApp (typeRep p)) == fst (splitTyConApp (typeRep (Proxy :: Proxy A)))
> isTypeVar (Proxy :: Proxy A)
True
> isTypeVar (Proxy :: Proxy Int)
False
The A
, B
, C
, an D
types can still be exported, but now if someone wants more they can have as many as they want.
Preconditions should be able to use both the seed value and the free variables.
Call out to QuickSpec or Speculate (probably Speculate, as I want conditional equations eventually)
unifyAccum :: Bool -> (Maybe TypeEnv -> Maybe TypeEnv) -> [TypeRep] -> [TypeRep] -> Maybe TypeEnv
unifyAccum b f as bs = foldr go (Just []) (zip as bs) where
go (tyA, tyB) (Just env) = do
assignments <- f (unify' b tyA tyB)
let env' = nub (env ++ assignments)
guard $ all (\v -> length (filter ((==v) . fst) env') <= 1) tyvars
pure env'
go _ Nothing = Nothing
The nub / guard
is too strict, it requires that type variables have equal assignments, rather than just unifying assignments. A better solution is a unifyTypeEnvs :: TypeEnv -> TypeEnv -> Maybe TypeEnv
function which finds all clashes and attempts to unify them, continuing recursively if this introduces new constraints.
There are two problems with the current syntax:
-[-
is not a valid Haskell operator name, because someone could do this:instance Num a => Num [a] where
fromIntegral n = [fromInteger n]
a - b = [sum a - sum b]
...
> 3 -[- 6 ]
9
This might be necessary, best to implement it sooner rather than later.
Knowing that something is neutral can actually be fairly interesting!
Hard to do without causing regressions. Branch wip-more-general-interference has a rough prototype.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.