Giter VIP home page Giter VIP logo

Comments (7)

sjoerdvisscher avatar sjoerdvisscher commented on June 24, 2024

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.

HeinrichApfelmus avatar HeinrichApfelmus commented on June 24, 2024

@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.

HeinrichApfelmus avatar HeinrichApfelmus commented on June 24, 2024

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.

bluescreen303 avatar bluescreen303 commented on June 24, 2024

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.

HeinrichApfelmus avatar HeinrichApfelmus commented on June 24, 2024

Great!

We can make a CPP conditional for the Int if you like.

from vault.

bluescreen303 avatar bluescreen303 commented on June 24, 2024

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.

HeinrichApfelmus avatar HeinrichApfelmus commented on June 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.