Skip to content

Instantly share code, notes, and snippets.

@aristidb
Forked from anonymous/gist:780616
Created January 15, 2011 02:05
Show Gist options
  • Save aristidb/780617 to your computer and use it in GitHub Desktop.
Save aristidb/780617 to your computer and use it in GitHub Desktop.
-- | Get this amount's commodity and any commodities referenced in its price.
amountCommodities :: Amount -> [Commodity]
amountCommodities Amount{commodity=c,price=p} =
case p of Nothing -> [c]
Just (UnitPrice ma) -> c:(concatMap amountCommodities $ amounts ma)
Just (TotalPrice ma) -> c:(concatMap amountCommodities $ amounts ma)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment