Created
May 25, 2009 00:40
-
-
Save simonmichael/117319 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | From a list of account names, select those which are direct | |
-- subaccounts of the given account name. | |
subAccountNamesFrom ∷ [AccountName] → AccountName → [AccountName] | |
subAccountNamesFrom accts a = filter (`isSubAccountNameOf` a) accts | |
accountNameTreeFrom accts = | |
Node "top" $ unfoldForest (λa → (a, subs a)) $ topAccountNames accts | |
where | |
subs = subAccountNamesFrom allaccts | |
allaccts = expandAccountNames accts | |
-- subs' a = subsmap ! a | |
-- subsmap :: Map AccountName [AccountName] | |
-- subsmap = Data.Map.fromList [(a, subAccountNamesFrom allaccts a) | a <- allaccts] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment