Comments (7)
I didn't try it, but ST is in the UHC repository: https://github.com/uhc/uhc/blob/master/EHC/ehclib/base/Control/Monad/ST.hs
from vault.
@sjoerdvisscher Nice!
The package now uses GHC-specific extensions only when they are available.
Furthermore, I have included a module Data.Unique.Really
that provides unique symbols that can survive a GHCi reload. This is important for type safety!
from vault.
For posterity, there is also a package
http://hackage.haskell.org/package/statethread
that implements the ST
monad in terms of IORef
and can be used with other compilers.
from vault.
This variant works fine with UHC.
Only thing I needed to implement was Data.Unique, for which I chose a simple increment_from_0 counter.
I did one extra tweak to vault's codebase: change Integer to Int in Data/Unique/Really.hs
Int is implemented natively in javascript, while Integer (infinite precision) needs a library. This library is not that huge, but I've managed to avoid it until now.
As javascript's Int is 53bit according to the ECMA standard (independent if the host platform is 32 or 64 bit) , this is more than enough for my needs.
But I don't expect vault to follow this, as this might be problematic on a 32bit architecture.
from vault.
Great!
We can make a CPP conditional for the Int
if you like.
from vault.
What would the condition be?
"if UHC" doesn't seem right. I don't know if there's a macro for
UHC/JS, but even then it's probably a bit personal.
It all depends on how many unique's you expect.
Probably for 32bit archs, maxBound is already quite enough.
The only somewhat logical choice is to target UHC/JS specifically.
Just leave it for now, I have small todo/findout list, I'll add
investigating possible macros and get back to you.
On Tue, Apr 10, 2012 at 6:35 PM, Heinrich Apfelmus
[email protected]
wrote:
Great!
We can make a CPP conditional for the
Int
if you like.
Reply to this email directly or view it on GitHub:
#5 (comment)
from vault.
The only somewhat logical choice is to target UHC/JS specifically.
Yup.
It's indeed rather narrow, but I am beginning to learn that sometimes, putting workarounds in the official branch can make life easier. (Had that problem with compilation of reactive-banana on GHC 7.2)
Just leave it for now, I have small todo/findout list,
Ok.
from vault.
Related Issues (14)
- code duplication HOT 3
- Vault fails to install with Cabal 1.18.0.1 HOT 4
- Invalid link in haddock on hackage HOT 2
- Is vault thread-safe? HOT 2
- Export either Vault.Lazy or Vault.Strict as Vault, again HOT 3
- Allow GHC 8.0 HOT 2
- release a new version on hackage (or make a hackage revision) to support hashable-1.3.0.0 HOT 11
- Travis integration is broken HOT 2
- Support GHC-9.6 HOT 1
- GHC 9.8 compat HOT 2
- GHC 9.10 compat HOT 1
- Control.Monad.ST.Unsafe not found HOT 5
- Unclear dependency (instance Hashable Unique) makes reactive-banana build fail HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vault.