Closed geraldus closed 10 years ago
Right, these haven't been added, probably because no one has asked for them before. There's a tradeoff here on whether we want to add separate modules for things or just stick as much as possible in Prelude
. I have a branch of fay-base where I've split up everything in pretty much the same module hierarchy as GHC has. I'll need to check how much of a performance decrease it would be to have lots of modules in fay-base. I might also just wait until we get haskell-packages support since this wouldn't be an issue in that case.
For now we can add these to Prelude, so if you end up adding them please send a pull request! I don't think people will have overridden these identifiers to be anything else. Remember that <*>
and <$>
need to be monomorphic to Fay.
@bergmark, Adam, so if I need to parse JavaScript String
to, say, Haskell Double
the solution is to declare foreign function, that takes care of it, instead of importing readS
, what's impossible now. Right?
Right. We should include that in fay-base too. This could be a module that isn't re-exported by Prelude
so it wouldn't add any overhead when you aren't using it. It could contain any low level JS operations parseFloat/parseInt/setTimeout
and others.
@bergmark, Adam, I only described mapM with another name (e.g. 'f' stands for Fay), thus there is almost nothing to pull :)
fMapM :: (a -> Fay b) -> [a] -> Fay [b]
fMapM fn lst = sequence $ map fn lst
I have another question: surprisingly when
works without any imports, but unless
does not. If when
exported to Fay, it would be great to have unless
being exported as well!
Data.Char
is still up for grabs if anyone wants to implement it. For now I think it makes sense to let it import Prelude instead of the other way around for efficiency reasons.
As for <$>
and <*>
, I don't think they would be very useful to restrict them to Fay (or any other Functor/Applicative) so it's probably better for users to alias to these on their own when they need it.
+1 on this being a need. I am not going to get around to implementing it myself, but it would be pretty nice to have.
I added Data.Char
, it contains ord
and chr
for now.
1a4dadba954c7a1254eed89919686137995a2dbf faylang/fay-base@eef4147f6316526e4f891aed9afe37d78633ebcd
This has been in fay-base for a while now!
I've unsuccessfully tried to import several modules (more precisely just a few functions from them), such as
Control.Applicative
Control.Monad
Data.Char
Is there a way to import any of them, of I have to reimplement needful functions (e.g.
toUpper
,mapM
,unless
,when
,<*>
,<$>
)?