FULE-0.3.1: Functional UI Layout Engine
Copyright(c) Paul Schnapp 2023
LicenseBSD3
MaintainerPaul Schnapp <paul.schnapp@gmail.com>
Safe HaskellSafe-Inferred
LanguageHaskell2010

FULE.Container.Item

Description

A wrapper for heterogenous content to be used by other Containers.

Synopsis

Documentation

data ItemM m k Source #

A container for heterogenous items. This container lets items of different types be used in the same aggregating container, like ArrayedM, GridM, or LayeredM.

When using ItemM you'll likely need to:

  • Use the ScopedTypeVariables language extension and explicitly specify a forall m in your function declaration (if a type-variable is being used)
  • Explicitly specify the type of your list of ItemM in the call to the aggregating container and wrap the list in parentheses

For example:

{-# LANGUAGE ScopedTypeVariables #-}

import FULE

...

someFn :: forall m => m (ArrayedM m Widget)
someFn = return $
  arrayedHoriz noPadding
    ([item someWidget
    , item someContainer
    , item someOtherWidget
    ]::[ItemM m Widget])

Reference: Heterogenous Collections

Instances

Instances details
Monad m => Container (ItemM m k) k m Source # 
Instance details

Defined in FULE.Container.Item

Methods

minWidth :: ItemM m k -> Proxy k -> m (Maybe Int) Source #

minHeight :: ItemM m k -> Proxy k -> m (Maybe Int) Source #

addToLayout :: ItemM m k -> Proxy k -> Bounds -> RenderGroup -> LayoutOp k m () Source #

type Item = ItemM Identity Source #

Like ItemM but run in the Identity monad.

item :: Container c k m => c -> ItemM m k Source #

Create an ItemM with a heterogenous item.