import Data.List (transpose)



kroneckerProduct :: Num a => [[a]] -> [[a]] -> [[a]]
kroneckerProduct xs ys =
  fmap (`f` ys) <$> xs
    >>= fmap concat . transpose
  where
    f = fmap . fmap . (*)



main :: IO ()
main =
  mapM_
    print
    ( kroneckerProduct
        [[1, 2], [3, 4]]
        [[0, 5], [6, 7]]
    )
    >> putStrLn []
    >> mapM_
      print
      ( kroneckerProduct
          [[0, 1, 0], [1, 1, 1], [0, 1, 0]]
          [[1, 1, 1, 1], [1, 0, 0, 1], [1, 1, 1, 1]]
      )