I am building a description of page state using a list of pageStyles
> data PageStyle=    Orientation Orient 
>                  | Margin BoxData
>                  | Border BoxData
>                  | CurrentYPos Float
>                  | CurrentXPos Float

To extract particular items from the current pagestate, I create functions
of the form:

> border [] = error "no border in page"
> border (a:xs) = case a of
>       Border x -> x
>       otherwise -> border xs

It would be much nicer if I could create a generalized form of this like:
> border p = extract Border "no border in page" p

But the extract function appears to be illegal:
> extract f s [] = error s
> extract f s (a:xs) = case a of
>            f x -> x
>            otherwise -> extract f s xs

Is there another way of getting this functionality?

-Alex-

___________________________________________________________________
S. Alexander Jacobson                   i2x Media  
1-212-697-0184 voice                    1-212-697-1427 fax


Reply via email to