Changeset 15096 for src/Pugs/Val
- Timestamp:
- 01/19/07 17:41:44 (22 months ago)
- Files:
-
- 1 modified
-
src/Pugs/Val/Base.hs (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Val/Base.hs
r13587 r15096 1 {-# OPTIONS_GHC -fglasgow-exts -fallow-overlapping-instances -funbox-strict-fields #-}1 {-# OPTIONS_GHC -fglasgow-exts -fallow-overlapping-instances -funbox-strict-fields -fallow-undecidable-instances #-} 2 2 3 3 module Pugs.Val.Base where … … 6 6 7 7 import Pugs.Internals 8 import Pugs.Class 8 9 import {-# SOURCE #-} Pugs.Val 9 10 … … 33 34 asNative :: a -> m ValNative 34 35 asNative = fmap (NBuf . cast) . asStr 36 classOf :: a -> MI m 37 fromObj :: Invocant m -> m a 35 38 36 39 type PureList = Seq Val -- Seq (Either PureSeq PureRange) -- XXX - *very bogus* … … 107 110 -- PureStr 108 111 109 newtype PureStr = MkStr ByteStringderiving112 newtype PureStr = MkStr { unStr :: ByteString } deriving 110 113 ( Typeable, Show, Eq, Ord, Data 111 114 , (:>:) ID, (:<:) ID … … 117 120 parseInt (MkStr s) = maybe 0 fst (Char8.readInt s) 118 121 122 instance (Typeable1 m, Ord a, ICoercible m a) => Boxable m a where 123 fromObjBox = fromObj 124 classOfBox = classOf 125 119 126 instance ICoercible P PureStr where 120 127 asBit (MkStr s) … … 124 131 asNum = cast . parseInt -- XXX - wrong 125 132 asInt = cast . parseInt 133 fromObj (MkInvocant x _) = undefined 134 classOf _ = mkBoxClass "Str" 135 [ "reverse" ... (MkStr . Char8.reverse . unStr) 136 ] 126 137
