Reformat with hindent

This commit is contained in:
Sumit Sahrawat 2015-06-23 23:25:31 +05:30
parent 8f3f18c5e1
commit e68fbb8ec3
2 changed files with 8 additions and 16 deletions

View File

@ -1,11 +1,6 @@
{-# LANGUAGE OverloadedStrings #-}
module IHaskell.Display.Widgets.Common (
-- * Predefined button styles
ButtonStyle(..),
-- * Image formats
ImageFormat(..),
) where
module IHaskell.Display.Widgets.Common (ButtonStyle(..), ImageFormat(..)) where
import Data.Aeson (ToJSON(..))
import qualified Data.Text as T
@ -28,7 +23,9 @@ instance ToJSON ButtonStyle where
toJSON None = ""
-- | Image formats for ImageWidget
data ImageFormat = PNG | SVG | JPG
data ImageFormat = PNG
| SVG
| JPG
deriving Eq
instance Show ImageFormat where

View File

@ -50,8 +50,9 @@ data ImageWidget =
newtype ImageInt = ImageInt { unwrap :: Int }
instance ToJSON ImageInt where
toJSON (ImageInt n) | n > 0 = toJSON $ str $ show n
| otherwise = toJSON $ str $ ""
toJSON (ImageInt n)
| n > 0 = toJSON $ str $ show n
| otherwise = toJSON $ str $ ""
-- | Create a new image widget
mkImageWidget :: IO ImageWidget
@ -64,13 +65,7 @@ mkImageWidget = do
val <- newIORef ""
let initData = object ["model_name" .= str "WidgetModel", "widget_class" .= str "IPython.Image"]
b = ImageWidget
{ uuid = commUUID
, format = fmt
, height = hgt
, width = wdt
, b64value = val
}
b = ImageWidget { uuid = commUUID, format = fmt, height = hgt, width = wdt, b64value = val }
-- Open a comm for this widget, and store it in the kernel state
widgetSendOpen b initData (toJSON b)