-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from inaka/jfacorro.21.state.records
[#21] State records in OTP modules.
- Loading branch information
Showing
13 changed files
with
248 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-module(fail_state_record_and_type). | ||
|
||
-behavior(gen_server). | ||
|
||
-export([ | ||
init/1, | ||
handle_call/3, | ||
handle_cast/2, | ||
handle_info/2, | ||
code_change/3, | ||
terminate/2 | ||
]). | ||
|
||
-spec init(term()) -> ok. | ||
init(_Args) -> | ||
ok. | ||
|
||
-spec handle_call(term(), term(), term()) -> ok. | ||
handle_call(_Request, _From, _State) -> | ||
ok. | ||
|
||
-spec handle_cast(term(), term()) -> ok. | ||
handle_cast(_Request, _State) -> | ||
ok. | ||
|
||
-spec handle_info(term(), term()) -> ok. | ||
handle_info(_Info, _State) -> | ||
ok. | ||
|
||
-spec code_change(term(), term(), term()) -> term(). | ||
code_change(_OldVsn, State, _Extra) -> | ||
{ok, State}. | ||
|
||
-spec terminate(term(), term()) -> ok. | ||
terminate(_Reason, _State) -> | ||
ok. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
-module(fail_state_type). | ||
|
||
-behavior(gen_server). | ||
|
||
-export([ | ||
init/1, | ||
handle_call/3, | ||
handle_cast/2, | ||
handle_info/2, | ||
code_change/3, | ||
terminate/2 | ||
]). | ||
|
||
-record(state, {}). | ||
|
||
-spec init(term()) -> ok. | ||
init(_Args) -> | ||
#state{}. | ||
|
||
-spec handle_call(term(), term(), term()) -> ok. | ||
handle_call(_Request, _From, _State) -> | ||
ok. | ||
|
||
-spec handle_cast(term(), term()) -> ok. | ||
handle_cast(_Request, _State) -> | ||
ok. | ||
|
||
-spec handle_info(term(), term()) -> ok. | ||
handle_info(_Info, _State) -> | ||
ok. | ||
|
||
-spec code_change(term(), term(), term()) -> term(). | ||
code_change(_OldVsn, State, _Extra) -> | ||
{ok, State}. | ||
|
||
-spec terminate(term(), term()) -> ok. | ||
terminate(_Reason, _State) -> | ||
ok. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
-module(pass_state_record_and_type). | ||
|
||
-behavior(gen_server). | ||
|
||
-export([ | ||
init/1, | ||
handle_call/3, | ||
handle_cast/2, | ||
handle_info/2, | ||
code_change/3, | ||
terminate/2 | ||
]). | ||
|
||
-record(state, {}). | ||
|
||
-type state() :: #state{}. | ||
|
||
-spec init(term()) -> state(). | ||
init(_Args) -> | ||
#state{}. | ||
|
||
-spec handle_call(term(), term(), term()) -> ok. | ||
handle_call(_Request, _From, _State) -> | ||
ok. | ||
|
||
-spec handle_cast(term(), term()) -> ok. | ||
handle_cast(_Request, _State) -> | ||
ok. | ||
|
||
-spec handle_info(term(), term()) -> ok. | ||
handle_info(_Info, _State) -> | ||
ok. | ||
|
||
-spec code_change(term(), term(), term()) -> term(). | ||
code_change(_OldVsn, State, _Extra) -> | ||
{ok, State}. | ||
|
||
-spec terminate(term(), term()) -> ok. | ||
terminate(_Reason, _State) -> | ||
ok. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters