[Haskell-cafe] overloading integer literals

Евгений Пермяков permeakra at gmail.com
Tue Aug 14 10:23:02 CEST 2012


During development some toy base library I found impossible to use 
Numeric literals. Quick search showed, that one need both fromInteger in 
scope (reasonable) and, as I understand, access to Integer type from 
'base' package ('base' for clarity later). It is perfectly reasonable if 
we assume that every module must depend on 'base'. However, with 
ghc-prim and NoIplicitPrelude it is not necessary this way. One may wish 
to drop 'base' dependency entirely. Currently, the only workaround I 
found is to use cast from string literals (that works perfectly okay) or 
use unboxed literals like 0xBB## (of unboxed type). Both solutions look 
dirty, especially in pattern guards.

Is there any better solution or movement to improve RebindableSyntax 
facilities ? for example, moving out classes for RebindableSyntax into 
ghc-prim package and tuning them so all syntax facilities in base could 
be defined in terms of RebindableSyntax  would be great.



More information about the Haskell-Cafe mailing list