[Haskell-cafe] ByteString.pack behavior
Don Stewart
dons at galois.com
Tue May 20 13:36:50 EDT 2008
aslatter:
> On Tue, May 20, 2008 at 8:44 AM, Antoine Latter <aslatter at gmail.com> wrote:
> >
> > It's up on hackage here:
> > http://hackage.haskell.org/cgi-bin/hackage-scripts/package/checked
> >
>
> One more thing - there's no "Data" instance for these types.
> Presumably it wouldn't be hard to add, I just wasn't familiar with the
> class, and the technique (if any) for lifting an instance of Data
> through a newtype wasn't immediately obvious form the class interface.
With generalised newtype deriving, it should be fine to derive Data and
Typeable:
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module M where
import Data.Generics
newtype T = T Int
deriving (Eq,Ord,Show,Read,Bounded,Enum,Num,Data,Typeable)
x :: T
x = 1 + 2
-- Don
More information about the Haskell-Cafe
mailing list