Hi,

for my streaming fasta library I introduced this:


newtype Index t = Index {unIndex :: Int64}

data One
data Zero

type FastaIndex = Index One

class MkIndex t ....
  mkIndex ...
  Index .+ Int64 = ...


as I wanted generic index handling for different ways to start counting.

The fasta library itself will, in its conduit-based version, soon be on
hackage. I need to beautify some things.

Gruss,
Christian

* Ketil Malde <ke...@malde.org> [16.07.2012 08:06]:
> David Powell <david.pow...@monash.edu> writes:
> 
> > On 13 July 2012 13:17, Dan Fornika <dforn...@gmail.com> wrote:
> 
> >> newtype Offset = Offset { unOff :: Int64 } deriving
> >> (Show,Eq,Ord,Num,Enum,Real,**Integral,Typeable)
> 
> You should also be able to use fromIntegral to convert from Offsets to
> arbitrary numeric types.
> 
> > I think the version of Bio.Sequence.SeqData that you took that function
> > from is using "type Offset = Int64" which is why it works there. 
> 
> Yes, when factoring out biocore, we decided to make newtypes for various
> types in order to improve type safety.  I'm not 100% sure this is always
> the right thing to do, sometimes fast and loose is what works best - but
> in general it's better to err on the side of safety.
> 
> -k
> -- 
> If I haven't seen further, it is by standing in the footprints of giants
> _______________________________________________
> Biohaskell mailing list
> Biohaskell@biohaskell.org
> http://malde.org/cgi-bin/mailman/listinfo/biohaskell

Attachment: pgpMBbGDlg7nv.pgp
Description: PGP signature

_______________________________________________
Biohaskell mailing list
Biohaskell@biohaskell.org
http://malde.org/cgi-bin/mailman/listinfo/biohaskell

Reply via email to