Re: Functional design question

[email protected] Mon, 23 Mar 2026 01:32:22 +0100
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <[email protected]>
Am 23.03.26 um 01:09 schrieb Albert Y. C. Lai:
> Perhaps
> 
> DirectoryConfig<C> {
>    Pair<Path,C> path
>    Pair<String,C> file
> }
> 
> Context {
>    String filename
>    int lineNumber, columnNumber
> }
> 
> Pair is a 2-tuple type.
> 
> Unit is an informationless type.
> 
> Then you can have DirectoryConfig<Context> and DirectoryConfig<Unit>.

Assuming directoryConfig is a variable of type DirectoryConfig, I'd have 
to access the values as directoryConfig.path.first, so that's not an 
improvement over directoryConfig.path.value.

It does hide the context information; how would I map from a 
DirectoryConfig<Context> to a DirectoryConfig<Unit>?
The data structure is deeply nested; there's a
   List<DirectoryConfig> children
in each DirectoryConfig, and the whole thing is inside a SiteConfig 
which in turn is inside a GlobalConfig, so it's not just hierarchical 
but heterogenously nested.

Regards,
Jo
_______________________________________________
Haskell-Cafe mailing list -- [email protected]
To (un)subscribe, modify options or view archives go to:
Only members subscribed via the mailman list are allowed to post.