- fromConstr con = case constrRep con of
- (StringConstr [x]) -> x
- _ -> error "fromConstr"
+ gunfold k z c = case constrRep c of
+ (StringConstr [x]) -> z x
+ _ -> error "gunfold"
- fromConstr con = case constrRep con of
- (FloatConstr x) -> realToFrac x
- _ -> error "fromConstr"
+ gunfold k z c = case constrRep c of
+ (FloatConstr x) -> z (realToFrac x)
+ _ -> error "gunfold"
- fromConstr con = case constrRep con of
- (IntConstr x) -> fromIntegral x
- _ -> error "fromConstr"
+ gunfold k z c = case constrRep c of
+ (IntConstr x) -> z (fromIntegral x)
+ _ -> error "gunfold"
- fromConstr con = case constrRep con of
- (IntConstr x) -> fromIntegral x
- _ -> error "fromConstr"
+ gunfold k z c = case constrRep c of
+ (IntConstr x) -> z (fromIntegral x)
+ _ -> error "gunfold"
- fromConstr con = case constrRep con of
- (IntConstr x) -> fromIntegral x
- _ -> error "fromConstr"
+ gunfold k z c = case constrRep c of
+ (IntConstr x) -> z (fromIntegral x)
+ _ -> error "gunfold"
- fromConstr con = case constrRep con of
- (IntConstr x) -> fromIntegral x
- _ -> error "fromConstr"
+ gunfold k z c = case constrRep c of
+ (IntConstr x) -> z (fromIntegral x)
+ _ -> error "gunfold"
- fromConstr con = case constrRep con of
- (IntConstr x) -> fromIntegral x
- _ -> error "fromConstr"
+ gunfold k z c = case constrRep c of
+ (IntConstr x) -> z (fromIntegral x)
+ _ -> error "gunfold"
- fromConstr con = case constrRep con of
- (IntConstr x) -> fromIntegral x
- _ -> error "fromConstr"
+ gunfold k z c = case constrRep c of
+ (IntConstr x) -> z (fromIntegral x)
+ _ -> error "gunfold"
- fromConstr con = case constrRep con of
- (IntConstr x) -> fromIntegral x
- _ -> error "fromConstr"
+ gunfold k z c = case constrRep c of
+ (IntConstr x) -> z (fromIntegral x)
+ _ -> error "gunfold"
- fromConstr con = case constrRep con of
- (IntConstr x) -> fromIntegral x
- _ -> error "fromConstr"
+ gunfold k z c = case constrRep c of
+ (IntConstr x) -> z (fromIntegral x)
+ _ -> error "gunfold"
- fromConstr con = case constrRep con of
- (IntConstr x) -> fromIntegral x
- _ -> error "fromConstr"
+ gunfold k z c = case constrRep c of
+ (IntConstr x) -> z (fromIntegral x)
+ _ -> error "gunfold"
- fromConstr con = case constrRep con of
- (IntConstr x) -> fromIntegral x
- _ -> error "fromConstr"
+ gunfold k z c = case constrRep c of
+ (IntConstr x) -> z (fromIntegral x)
+ _ -> error "gunfold"
- fromConstr c | constrIndex c == 1 = undefined :% undefined
- fromConstr _ = error "fromConstr"
- dataTypeOf _ = ratioDataType
+ gunfold k z c | constrIndex c == 1 = k (k (z (:%)))
+ gunfold _ _ _ = error "gunfold"
+ dataTypeOf _ = ratioDataType
gfoldl f z (Just x) = z Just `f` x
toConstr Nothing = nothingConstr
toConstr (Just _) = justConstr
gfoldl f z (Just x) = z Just `f` x
toConstr Nothing = nothingConstr
toConstr (Just _) = justConstr
gfoldl f z (Right a) = z Right `f` a
toConstr (Left _) = leftConstr
toConstr (Right _) = rightConstr
gfoldl f z (Right a) = z Right `f` a
toConstr (Left _) = leftConstr
toConstr (Right _) = rightConstr
instance (Data a, Data b) => Data (a -> b) where
toConstr _ = error "toConstr"
instance (Data a, Data b) => Data (a -> b) where
toConstr _ = error "toConstr"
- toConstr _ = tuple0Constr
- fromConstr c | constrIndex c == 1 = ()
- fromConstr _ = error "fromConstr"
- dataTypeOf _ = tuple0DataType
+ toConstr _ = tuple0Constr
+ gunfold k z c | constrIndex c == 1 = z ()
+ gunfold _ _ _ = error "gunfold"
+ dataTypeOf _ = tuple0DataType
instance (Data a, Data b) => Data (a,b) where
gfoldl f z (a,b) = z (,) `f` a `f` b
instance (Data a, Data b) => Data (a,b) where
gfoldl f z (a,b) = z (,) `f` a `f` b
- toConstr _ = tuple2Constr
- fromConstr c | constrIndex c == 1 = (undefined,undefined)
- fromConstr _ = error "fromConstr"
- dataTypeOf _ = tuple2DataType
- dataCast2 = gcast2
+ toConstr _ = tuple2Constr
+ gunfold k z c | constrIndex c == 1 = k (k (z (,)))
+ gunfold _ _ _ = error "gunfold"
+ dataTypeOf _ = tuple2DataType
+ dataCast2 = gcast2
instance (Data a, Data b, Data c) => Data (a,b,c) where
gfoldl f z (a,b,c) = z (,,) `f` a `f` b `f` c
instance (Data a, Data b, Data c) => Data (a,b,c) where
gfoldl f z (a,b,c) = z (,,) `f` a `f` b `f` c
- toConstr _ = tuple3Constr
- fromConstr c | constrIndex c == 1 = (undefined,undefined,undefined)
- fromConstr _ = error "fromConstr"
- dataTypeOf _ = tuple3DataType
+ toConstr _ = tuple3Constr
+ gunfold k z c | constrIndex c == 1 = k (k (k (z (,,))))
+ gunfold _ _ _ = error "gunfold"
+ dataTypeOf _ = tuple3DataType
=> Data (a,b,c,d) where
gfoldl f z (a,b,c,d) = z (,,,) `f` a `f` b `f` c `f` d
toConstr _ = tuple4Constr
=> Data (a,b,c,d) where
gfoldl f z (a,b,c,d) = z (,,,) `f` a `f` b `f` c `f` d
toConstr _ = tuple4Constr
- fromConstr c = case constrIndex c of
- 1 -> (undefined,undefined,undefined,undefined)
- _ -> error "fromConstr"
+ gunfold k z c = case constrIndex c of
+ 1 -> k (k (k (k (z (,,,)))))
+ _ -> error "gunfold"
=> Data (a,b,c,d,e) where
gfoldl f z (a,b,c,d,e) = z (,,,,) `f` a `f` b `f` c `f` d `f` e
toConstr _ = tuple5Constr
=> Data (a,b,c,d,e) where
gfoldl f z (a,b,c,d,e) = z (,,,,) `f` a `f` b `f` c `f` d `f` e
toConstr _ = tuple5Constr
- fromConstr c = case constrIndex c of
- 1 -> (undefined,undefined,undefined,undefined,undefined)
- _ -> error "fromConstr"
+ gunfold k z c = case constrIndex c of
+ 1 -> k (k (k (k (k (z (,,,,))))))
+ _ -> error "gunfold"
=> Data (a,b,c,d,e,f) where
gfoldl f z (a,b,c,d,e,f') = z (,,,,,) `f` a `f` b `f` c `f` d `f` e `f` f'
toConstr _ = tuple6Constr
=> Data (a,b,c,d,e,f) where
gfoldl f z (a,b,c,d,e,f') = z (,,,,,) `f` a `f` b `f` c `f` d `f` e `f` f'
toConstr _ = tuple6Constr
- fromConstr c =
- case constrIndex c of
- 1 -> (undefined,undefined,undefined,undefined,undefined,undefined)
- _ -> error "fromConstr"
+ gunfold k z c = case constrIndex c of
+ 1 -> k (k (k (k (k (k (z (,,,,,)))))))
+ _ -> error "gunfold"
gfoldl f z (a,b,c,d,e,f',g) =
z (,,,,,,) `f` a `f` b `f` c `f` d `f` e `f` f' `f` g
toConstr _ = tuple7Constr
gfoldl f z (a,b,c,d,e,f',g) =
z (,,,,,,) `f` a `f` b `f` c `f` d `f` e `f` f' `f` g
toConstr _ = tuple7Constr
- fromConstr c = case constrIndex c of
- 1 -> (undefined,undefined,undefined,undefined,undefined,undefined,undefined)
- _ -> error "fromConstr"
+ gunfold k z c = case constrIndex c of
+ 1 -> k (k (k (k (k (k (k (z (,,,,,,))))))))
+ _ -> error "gunfold"