mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-01-26 00:18:26 +00:00
33 lines
502 B
Elm
33 lines
502 B
Elm
|
module Data.ItemSelection exposing
|
||
|
( ItemSelection(..)
|
||
|
, isActive
|
||
|
, isSelected
|
||
|
)
|
||
|
|
||
|
import Set exposing (Set)
|
||
|
|
||
|
|
||
|
type ItemSelection
|
||
|
= Inactive
|
||
|
| Active (Set String)
|
||
|
|
||
|
|
||
|
isSelected : String -> ItemSelection -> Bool
|
||
|
isSelected id set =
|
||
|
case set of
|
||
|
Inactive ->
|
||
|
False
|
||
|
|
||
|
Active ids ->
|
||
|
Set.member id ids
|
||
|
|
||
|
|
||
|
isActive : ItemSelection -> Bool
|
||
|
isActive sel =
|
||
|
case sel of
|
||
|
Active _ ->
|
||
|
True
|
||
|
|
||
|
Inactive ->
|
||
|
False
|