This module
module Foo (Foo, qux) where
data Foo = Foo {bla::Int}
qux :: Foo
qux = Foo 37
causes a warning when compiled with -Wall
:
/tmp/wtmpf-file12937.hs:3:17: warning: [-Wunused-top-binds]
Defined but not used: ‘bla’
|
3 | data Foo = Foo {bla::Int}
| ^^^
Ok – if bla
were just a standalone function, this would be easy and should be fixed by removing bla
. But for a record, the fields do more than just provide a name that can be used, they also serve as documentation in the code.
What is the preferred way to get rid of the warning?
It should be a permanent solution, should preferrably keep the record as-is, and preferrably not disable any warnings for the rest of the module.
You can create a new record type and enable it for system admin profile only. Whenever you want to create a record that should be visible to admin only then choose this new record type. Other users will not be able to those records as they don't have access to that record type.
To define record level security in salesforce, first set your OWD (Org Wide Default) sharing settings and define a hierarchy, and then create sharing rules. It is easy that with roles, we can modify profile and permission set in Salesforce Org.
On the 'Records' page there is 'Added by' filter, using which you can filter records by user who added it. You can always save the result in Report. If you want to restrict your User's group to access users only their own records you need to enable 'Access to only own records' option.
To avoid these, I usually add a definition like this to the module:
_unused :: a
_unused = error "don't complain" bla
The nice thing is you can chain them, like so:
_unused :: a
_unused = error "don't complain" bla bah foo bar
It's kind of crude, but gets the job done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With