genArbitrary (HSStruct name  types) = concat [fst_line, snd_line,"\n"]
    where fst_line = concat ["instance Arbitrary ", name, " where \n"]
          snd_line = concat ["    arbitrary = oneof ", list_lines]   
          list_lines  = concat $ intersperse "                      " fillings
          fillings    = ('[':' ':f):(map (\x -> ',':' ':x) illings) ++ ["]"]
          (f:illings) = zipWith (\ix t -> filling ix t ++ "\n") [1..] types
          filling ix  tps = concat [name, s_ix ix, " <$> ", arbitraries tps]
          arbitraries tps = concat $ intersperse " <*> "$ take (length tps) $ repeat "arbitrary"
genArbitrary (HSStruct name  types) = concat [fst_line, snd_line,"\n"]
    where fst_line = concat ["instance Arbitrary ", name, " where \n"]
          snd_line = concat ["    arbitrary = oneof ", list_lines]   
          list_lines  = concat $ intersperse "                      " fillings
          fillings    = ('[':' ':f):(map (\x -> ',':' ':x) illings) ++ ["]"]
          (f:illings) = zipWith (\ix t -> filling ix t ++ "\n") [1..] types
          filling ix  tps = concat [name, s_ix ix, " <$> ", arbitraries tps]
          arbitraries tps = concat $ intersperse " <*> "$ take (length tps) $ repeat "arbitrary"
genArbitrary (HSStruct name  types) = concat [fst_line, snd_line,"\n"]
    where fst_line = concat ["instance Arbitrary ", name, " where \n"]
          snd_line = concat ["    arbitrary = oneof ", list_lines]   
          list_lines  = concat $ intersperse "                      " fillings
          fillings    = ('[':' ':f):(map (\x -> ',':' ':x) illings) ++ ["]"]
          (f:illings) = zipWith (\ix t -> filling ix t ++ "\n") [1..] types
          filling ix  tps = concat [name, s_ix ix, " <$> ", arbitraries tps]
          arbitraries tps = concat $ intersperse " <*> "$ take (length tps) $ repeat "arbitrary"