threepenny-editors 0.2.0.8 → 0.2.0.9
raw patch · 3 files changed
+19/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
CHANGELOG.md view
@@ -1,3 +1,5 @@+# 0.2.0.9 (2017-05-23)+ * Detect grid layouts and render them accordingly # 0.2.0.8 (2017-05-21) * Bug fixes # 0.2.0.7 (2017-05-20)
src/Graphics/UI/Threepenny/Editors/Base.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TupleSections #-}@@ -67,7 +68,21 @@ single :: Element -> Layout single = Single +getHorizontal :: Layout -> Maybe [Layout]+getHorizontal (Horizontal h) = Just h+getHorizontal _ = Nothing++getSingle :: Layout -> Maybe Element+getSingle (Single e) = Just e+getSingle _ = Nothing++-- getGridLayout :: Layout -> Maybe [[Element]]+getGridLayout :: Layout -> Maybe [[Element]]+getGridLayout (Vertical hh) = mapM getHorizontal hh >>= mapM (mapM getSingle)+getGridLayout _ = Nothing+ runLayout :: Layout -> UI Element+runLayout (getGridLayout -> Just g) = grid (fmap (fmap return) g) runLayout (Vertical ll) = column $ fmap runLayout ll runLayout (Horizontal ll) = row $ fmap runLayout ll runLayout (Single x) = return x@@ -177,7 +192,7 @@ :: (Ord tag, Show tag) => [(tag, Compose UI EditorDef a)] -> (a -> tag) -> Behavior a -> Compose UI EditorDef a editorSum options selector ba = Compose $ do- options <- traverse (\(tag, Compose mk) -> (tag,) <$> (mk >>= runEditorDef)) options+ options <- mapM (\(tag, Compose mk) -> (tag,) <$> (mk >>= runEditorDef)) options let tag = selector <$> ba tag' <- calmB tag let build a = lookup a options
threepenny-editors.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: threepenny-editors-version: 0.2.0.8+version: 0.2.0.9 synopsis: Composable algebraic editors description: This package provides a type class 'Editable' and combinators to easily put together form-like editors for algebraic datatypes.