deriveIsList :: Name -> DecsQ
deriveIsList name =  do
  wrappedCon <- getWrappedTypeCon name
  let wrappedConName = conName wrappedCon
  let outerType = conT name
      outerPattern = conP wrappedConName [varP $ mkName "x"]
      innerType = return $ unarrayT $ conType wrappedCon
  [d|
   instance IsList $(outerType) where
     type Item $(outerType) = $(innerType)
     fromList xs = $(appE (conE wrappedConName) $ appE (conE 'ArrayOf) $ dyn "xs")
     toList $(outerPattern) = case $(dyn "x") of
       ArrayOf xs -> xs
    |]

-- | Fills out Restricts, SchemaType, and SimpleType for a simple NewType wrapper
deriveIsList :: Name -> DecsQ
deriveIsList name =  do
  wrappedCon <- getWrappedTypeCon name
  let wrappedConName = conName wrappedCon
  let outerType = conT name
      outerPattern = conP wrappedConName [varP $ mkName "x"]
      innerType = return $ unarrayT $ conType wrappedCon
  [d|
   instance IsList $(outerType) where
     type Item $(outerType) = $(innerType)
     fromList xs = $(appE (conE wrappedConName) $ appE (conE 'ArrayOf) $ dyn "xs")
     toList $(outerPattern) = case $(dyn "x") of
       ArrayOf xs -> xs
    |]

-- | Fills out Restricts, SchemaType, and SimpleType for a simple NewType wrapper
deriveIsList name =  do
  wrappedCon <- getWrappedTypeCon name
  let wrappedConName = conName wrappedCon
  let outerType = conT name
      outerPattern = conP wrappedConName [varP $ mkName "x"]
      innerType = return $ unarrayT $ conType wrappedCon
  [d|
   instance IsList $(outerType) where
     type Item $(outerType) = $(innerType)
     fromList xs = $(appE (conE wrappedConName) $ appE (conE 'ArrayOf) $ dyn "xs")
     toList $(outerPattern) = case $(dyn "x") of
       ArrayOf xs -> xs
    |]

-- | Fills out Restricts, SchemaType, and SimpleType for a simple NewType wrapper