On Mon, Mar 28, 2011 at 9:26 PM, Nicholas Ingolia <n...@ingolia.org> wrote:
> On Mar 28, 2011, at 5:16 PM, Ketil Malde wrote:
>> this line of thought is interesting, I think.  Perhaps we can supply an
>> Offset1 newtype as well for use with 1-based data formats?  Probably
>> only internally, so that e.g. a SeqLoc will always use zero-based
>> offsets.
>
> I was thinking that there could be an alternate Bio.SeqLoc.Position1Based 
> module that re-exported Offset as an opaque data type and provided
>
> mkOffset1 :: Int64 -> Offset
> unOffset1 :: Offset -> Int64
>
> The internal representation would be unchanged but the client would see the 
> conversion of offsets to numbers using 1-based indexing (and your call on how 
> it deals with the -1/+1 jump).
>
> Handling the Num instance would be tricky, some of the operations would be 
> wrong (e.g., literal 0 of type (Num a) => a would not be shifted properly) 
> and others would be confusing (e.g., you don't add two 1-based offsets) but I 
> don't believe we can control the re-export of the Offset Num instance.

I believe this will be a great source of confusion.  I propose that we
use only one kind of Offset.  The frontend may use +1 or -1 where
appropriate.

Cheers,

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

Reply via email to