In my private 'quantified self', I'm coming across the same use case as yours @Joel McCracken. That is, being able to link from one file to another, while not falling back to url strings. Ideally I want to be able to directly refer to a Source type, but that doesn't seem practical. So thinking of ways ...
obelisk-route uses GADTs, so : JournalPage_Entry :: FilePath -> JournalPage (Source MMark) along those lines, I guess. I haven't fully thought about it yet.
I suspect if I'm to do it more properly it would involve extending the Source type and integrating it with a Route type somehow. It is in research phase right now.
In my private 'quantified self', I'm coming across the same use case as yours @Joel McCracken. That is, being able to link from one file to another, while not falling back to url strings. Ideally I want to be able to directly refer to a
Source
type, but that doesn't seem practical. So thinking of ways ...the way I am doing it now is that a single source basically defines a number of links that are avialable to it
so after each source is parsed
the links from each are aggregated
then, those links are used in the rendering step
If a document links to /foo/bar - how do you check that /foo/bar refers to one of the other documents?
well, what I have now is fairly limited in some ways
every document has a top level name (the filename - extension) and aliases
so
glossary.xml
i can link to in another doc via
Ideally I want to apply Haskell's "make illegal states non-representable" to interlinking too. This is done nicely with obelisk-routes (using GADTs)
<link to="glossary">Go to glossary</link>
yeah, this si all done at runtime
i';d have to do a lot more metaprogrammign to make it available at compiletime
in my case, the 'metadata' lives in Haskell - so I can use haskell values directly.
the thing is, its always build then immediate run
yep
you'll have to do some metaprogramming though i think
to generate types from the data
so that your routes are typesafe
well i dunno maybe not
I'm beginning to have hierarchical ADTs when defining pages with hierarchy: eg:
Probably the natural next step is to extend this so that each constructor 'maps' to an unique URL
if that works, that sounds good!
but how would you make sure journalpage_entry is typesafe?
(breadcrumbs are another feature this relates to)
what do you mean?
well if you "Probably the natural next step is to extend this so that each constructor 'maps' to an unique URL"
then you'll probably have something lik e
link (JournalPage_Entry "name of an entry")
i mean not exactly, but something lik ethis
obelisk-route uses GADTs, so :
JournalPage_Entry :: FilePath -> JournalPage (Source MMark)
along those lines, I guess. I haven't fully thought about it yet.sure, i guess what I amm saying is that in this case you need to cehck that the string is valid
if that's what you want to do
(just talking through the issues here =))
obelisk uses
universe
to do this checkI suspect if I'm to do it more properly it would involve extending the
Source
type and integrating it with aRoute
type somehow. It is in research phase right now.ic
interesting@
How can one source have more than one link to it? Or do you mean the anchor links (
<a id="foo" ...
)?yes, i mean anchor links
so like if i want to link to
glossary.html#monoid
this ALSO is useful for making a "table of contents" for a page
BTW you can link against any ID
not jsut anchor tags
so if
<div id="foobar">this is something great</div>
a great browser extension would be a thing that i can click
and will make it easy to link against anything on a page that has an ID
sometimes if i want to link to a specific part of an html page I will do this
inspect the element, see if it has an attached id