Skip to content

Source file standard license headers #75

@jhenahan

Description

@jhenahan

Is there a straightforward way to add a standard license header (in my specific case, to a Haskell source file)? That is, I'd like to be able to have a comment like

{-
This file is part of My Project
Copyright 2021 Me

Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file or at
https://spdx.org/licenses/BSD-3-Clause.html
-}

I tried a couple of hacky ways that have their own tradeoffs:

  • Inlining the text in the template (either as a separate comment or as a Haddock source block) causes duplication since _haskell_module_longdesc greedily consumes everything up to module
  • Dumping the text in _haskell_module_longdesc avoids duplication, but changes to the component variables are (correctly, if unhelpfully in this case) never picked up

I'm not particularly happy with either of those, but I figured I'd see if there was maybe an undocumented footer variable or something that I could co-opt for the purpose.

If this isn't currently possible, I'd likely be interested in putting in some work to get something working. In that event, would you imagine this would be best handled with

  • a new license-headers key (maybe, pre/postamble or footer or something)
  • a post-processor
  • making _haskell_module_longdesc less greedy

The last one feels like a scary regex mess waiting to happen, so I'm hopeful one of the other options would be a sensible place to start.

Thanks for Headroom and any input!

Metadata

Metadata

Assignees

Labels

featureNew feature or requestresearchSome research must be done before implementation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions