Skip to content

Issue with blaze-html #13

@maxigit

Description

@maxigit

I'm not sure if its a Vector issue or a blaze-html one, but there is something weird.
Basically I'm trying to convert a vector to html.
If I use Vector.mapM_ or Vector.forM_ it compiles but blows up , if I convert the vector to a list and use mapM_, everything is fine.
I assume that Vector.forM_ should be functionally equivalent to forM_.V.toList but it's not (therefore I think it's a Data.Vector problem ;-))

Here is a way to reproduce problem:

 {-# LANGUAGE OverloadedStrings #-}
  module Main where

  import Control.Monad (forM_)
  import qualified Data.ByteString.Lazy as BL
  import qualified Data.Vector as V

  import qualified Text.Blaze.Html5 as H
  import qualified Text.Blaze.Html.Renderer.String as R


  v :: V.Vector Int
  v = V.fromList [1..10]

  html :: H.Html
  html = V.forM_ v H.toHtml

  vForM_ = forM_ . V.toList

  html' :: H.Html
  html' = vForM_ v H.toHtml

 main = do
     putStrLn  $     R.renderHtml html'
     putStrLn "^ ok"
     putStr  $     R.renderHtml html
     putStrLn "^ ok"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions