In [1]:
import IHaskell.Display

-- My widget type
data Slider = Slider

instance IHaskellDisplay Slider where
  display Slider = return $ Display []
  
instance IHaskellWidget Slider where
  targetName _ = "WidgetModel"
  open _ s = s undefined >> error "what"
  
In [2]:
Slider
In [1]:
import Text.Parsec
import Text.Parsec.String
import Text.Parsec.Prim
import Text.Parsec.Char

data List = List [Float] deriving Show

let -- Parse a nonempty int list like [1, 2, 3]
    parser :: Parser List
    parser = do
      char '['
      values <- option [] $ many1 (try float <|> int)
      char ']'
      return $ List values
      
    -- Parse an element of an int list,  like "3, "
    int :: Parser Float
    int = do
      value <- many1 $ oneOf "0123456789"
      optional $ char ','
      whitespace
      return (fromIntegral (read value :: Int) :: Float)
      
    float :: Parser Float
    float = do
      value <- many1 $ oneOf "0123456789"
      char '.'
      after <- many1 $ oneOf "0123456789"
      optional $ char ','
      whitespace
      return (read (value ++ "." ++ after) :: Float)
      
    -- Parse any whitespace
    whitespace = many $ oneOf " \t"
In [9]:
parser

In [ ]: