template haskell vs. -prof

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

template haskell vs. -prof

Evan Laforge
I ran into trouble compiling template haskell with -prof, and came
across the ghc manual "7.9.4. Using Template Haskell with Profiling".
Unfortunately I can't use its advice directly since I put profiling
and non-profiling .o files into different directories.  But in
principle it seems it should work, I just have to get ghc to load TH
from the debug build directory, which is built with -dynamic, while
continuing to load from the profile build directory.

But are there flags to get it to do that?  I'm using "-osuf .hs.o
-ibuild/profile/obj".  If I put ":build/debug/obj" on the -i line, it
still seems to find the profiling one.  The ghc manual advice probably
gets around it by using different -osufs... I guess TH somehow ignores
-osuf?  Except when I compile the debug version with osuf, if finds
them fine, so I don't really know how it works.

Is there a way I can directly tell TH where to look?  It seems awkward
to rely on all these implicit and seemingly undocumented heuristics.

And, this is somewhat beside the point, but shouldn't TH theoretically
be able to load directly from .hs and compile to bytecode like ghci
can do if it doesn't find the .o file?

And, even more beside the point, the only reason I'm messing with TH
is for a really simple (one line) multi-line string literal
quasiquote.  Surely I'm not the only person who would enjoy a
-XMultiLineStringLiteral extension?  The alternative seems to be a
program to add or strip all of the "\n\"s, and when I want to edit,
copy out, strip, edit, paste back in, add back.  At that point maybe
it's easier to just get used to all the \s... but then indentation is
all a bit off due to the leading \.
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: template haskell vs. -prof

John Lato-2
I agree that mixing template haskell with -prof can be tricky.  It's easier if you turn off dynamic linking entirely.

As for multi-line string literals, I also think that an explicit syntax would be nice.  Until then, I usually use:

    unlines
      [ "Line 1"
      , "Line 2"
      ]

which ends up being pretty maintainable and easy to read.

On Fri Jan 23 2015 at 6:16:46 AM Evan Laforge <[hidden email]> wrote:
I ran into trouble compiling template haskell with -prof, and came
across the ghc manual "7.9.4. Using Template Haskell with Profiling".
Unfortunately I can't use its advice directly since I put profiling
and non-profiling .o files into different directories.  But in
principle it seems it should work, I just have to get ghc to load TH
from the debug build directory, which is built with -dynamic, while
continuing to load from the profile build directory.

But are there flags to get it to do that?  I'm using "-osuf .hs.o
-ibuild/profile/obj".  If I put ":build/debug/obj" on the -i line, it
still seems to find the profiling one.  The ghc manual advice probably
gets around it by using different -osufs... I guess TH somehow ignores
-osuf?  Except when I compile the debug version with osuf, if finds
them fine, so I don't really know how it works.

Is there a way I can directly tell TH where to look?  It seems awkward
to rely on all these implicit and seemingly undocumented heuristics.

And, this is somewhat beside the point, but shouldn't TH theoretically
be able to load directly from .hs and compile to bytecode like ghci
can do if it doesn't find the .o file?

And, even more beside the point, the only reason I'm messing with TH
is for a really simple (one line) multi-line string literal
quasiquote.  Surely I'm not the only person who would enjoy a
-XMultiLineStringLiteral extension?  The alternative seems to be a
program to add or strip all of the "\n\"s, and when I want to edit,
copy out, strip, edit, paste back in, add back.  At that point maybe
it's easier to just get used to all the \s... but then indentation is
all a bit off due to the leading \.
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: template haskell vs. -prof

Evan Laforge
On Sat, Jan 24, 2015 at 2:38 AM, John Lato <[hidden email]> wrote:
> I agree that mixing template haskell with -prof can be tricky.  It's easier if you turn
> off dynamic linking entirely.

But that's the thing, I do turn of dynamic linking because I have to
for -prof, but TH seems to require it.

>     unlines
>       [ "Line 1"
>       , "Line 2"
>       ]
>
> which ends up being pretty maintainable and easy to read.

Yeah, I use this one too.  It's ok for short things, but it can still
be annoying to edit.  My editor doesn't know how to do line wrapping
for it.  Then you can't just copy paste in and out.  And tabs get
messed up because you're already indented, and probably not in a
tabstop multiple... though I guess I could align it so it was.  And of
course since there's prefix gunk, folding doesn't work inside.

Actually, if anyone knows about a vim hack to make 'gq' handle either
this style or the backslash style, it would be much appreciated...
maybe I should try to create one.
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: template haskell vs. -prof

John Lato-2

On 21:23, Fri, Jan 23, 2015 Evan Laforge <[hidden email]> wrote:

On Sat, Jan 24, 2015 at 2:38 AM, John Lato <[hidden email]> wrote:
> I agree that mixing template haskell with -prof can be tricky.  It's easier if you turn
> off dynamic linking entirely.

But that's the thing, I do turn of dynamic linking because I have to
for -prof, but TH seems to require it.

I mean to use a ghc that's been built without dynamic support.

>     unlines
>       [ "Line 1"
>       , "Line 2"
>       ]
>
> which ends up being pretty maintainable and easy to read.

Yeah, I use this one too.  It's ok for short things, but it can still
be annoying to edit.  My editor doesn't know how to do line wrapping
for it.  Then you can't just copy paste in and out.  And tabs get
messed up because you're already indented, and probably not in a
tabstop multiple... though I guess I could align it so it was.  And of
course since there's prefix gunk, folding doesn't work inside.

Yeah, those are all problematic.



_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: template haskell vs. -prof

Evan Laforge
On Sat, Jan 24, 2015 at 1:29 PM, John Lato <[hidden email]> wrote:
> I mean to use a ghc that's been built without dynamic support.

Oh, so if the whole compiler is not dynamic then TH no longer requires
.dyn_o files?  Interesting.

I know they've put a lot of work into this and staging is hard, so I
assume there are good reasons for it :)
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users