erlang / pmod_transform Goto Github PK
View Code? Open in Web Editor NEWParse transform for parameterized modules
Parse transform for parameterized modules
Hi All,
The last push to hex.pm
was in 2017
(https://hex.pm/packages/pmod_transform). Could you please push package pmod_transform
with latest changes to the hex.pm
?
Could you please create an X.Y.Z tag, so that rebar's semver can create succinct directory name for this dependency?
when compile the paramtered module occur this error:
error in parse transform 'pmod_pt': {function_clause,
[{pmod_pt,expr,
[{record_index,71,buff,{atom,71,id}},
{pmod, ...}],
[{file,"./pmod_transform/pmod_pt.erl"},
{line,296}]}
]}
Related to: rabbitmq/erlando#12 (comment)
It seems a module can't have both -behaviour(..)
and -compile({parse_transform, pmod_pt})
at the same time. I think the reason is behaviour tries to validate callback functions after pmot_pt is applied(?)
state_t.erl
-module(state_t, [InnerMonad]).
-compile({parse_transform, do}).
-compile({parse_transform, pmod_pt}).
-behaviour(monad).
-export(['>>='/2, return/1, fail/1]).
...
monad.erl
behaviour_info(callbacks) ->
[{'>>=', 2},
{return, 1},
{fail, 1}];
state_t module doesn't compile:
src/state_t.erl:21: undefined callback function '>>='/2 (behaviour 'monad')
src/state_t.erl:21: undefined callback function fail/1 (behaviour 'monad')
src/state_t.erl:21: undefined callback function return/1 (behaviour 'monad')
If I remove -behaviour(monad)
, it compiles. Note that each function has an extra parameter (e.g. '>>='/3
, not '>>='/2
)
Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V5.10.1 (abort with ^G)
...
3> state_t:module_info().
[{exports,[{'>>=',3},
{return,2},
{fail,2},
{get,1},
{put,2},
{eval,3},
{exec,3},
{run,3},
{modify,2},
{modify_and_return,2},
{lift,2},
{new,1},
{instance,1},
{module_info,0},
{module_info,1}]},
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.