My Internship with OCaml: Outreachy Summary

<Hello World/>

Now that the Outreachy internship is about to end, it’s time, to sum up, the final project progress and my erudite and productive internship journey with OCaml Organisation. Before moving further, I remind you, Outreachy is a diversity initiative that provides paid, remote internships to the people who identify as underrepresented groups in the tech industry. I was selected as an Outreachy intern to work with the OCaml organization on the project ‘Improve OCaml.org website’.

OCaml is a general-purpose programming language with rich toolsets and libraries and its community comprise mainly of functional programmers.

About Project:

My project with the organization is working on the launch of the V3(version) of the main OCaml.org website to support some new features coming to OCaml such as Multicore Support.

Tech Stacks Required for the Project:

The V3 site of OCaml is built on  OCaml (for processing data) and various other modern technologies like ReScript (for frontend work), NextJs (for server-side rendering and generating static website), and Tailwind (CSS framework to build modern websites in an easy and customized way).

My Project Tasks:

My main project goals were to:

  • Implement Web designs for webpages using ReScript and Tailwind.
  • Import data from the old repo of OCaml.org to ocaml/ood repo to use in the V3 site.
  • Improve accessibility of the Website.
  • Provide data/content wherever required.
  • Writing an Outreachy Blog every fortnight during the internship about my internship progress.

 A Quick  Glance at ReScript:

One of the limitations of Javascript is that it’s a weakly typed programming language while it’s also very dynamic giving developers reason to use JS. But what if we want a programming language that has both dynamic as well strong type system features. And here, ReScript comes into play.

ReScript is a new and strongly typed programming language that combines the best parts of JS and OCaml making development much faster and smoother.

So let me tell you why the type system is very important and how ReScript is addressing this issue?

Type System in  OCaml and ReScript:

Static typing includes declaring types of variables, function returns, etc. It can be possible that a variable that is declared gets assigned with a different type. When using a Type system, the compiler will throw an error if something is called with “incorrect type”.This allows the developer to see the type error easily by just running terminal commands and hence the possibility of breaking of code during runtime gets avoided. Thus ReScript having OCaml’s type system feature helps in the maintenance of an extensive codebase where a large scale of type errors are possible, thus reducing the effort and cost of production. 

Here is how the ReScript compiler throws an error:

A helpful error (as the compiler is suggesting what type error it is having.)

ReScript-React:

The ReScript has inbuilt Reactjs bindings that enable developers to use react features. It  has two file extensions .res for implementation and .resi for interface.On compiling, .js files are produced with js output for ReScript codes. 

ReScript Code
Javascript Output

Bindings in ReScript- pros, and cons:

Bindings in ReScript is a way to use JS functions/libraries and third-party APIs in ReScript. For example, if a project needs react leaflet library, first dependencies for leaflet are installed and then one binding file with .res extension is created specifying the types of the Leaflet’s function and containers. So that the containers of the third party can be accessed in the project. Below is the binding for MapContainer:

ReScript binding for MapContainer (React-Leaflet container)
  • Pros: easy to use existing JS libraries.
  • Cons: Sometimes it takes more effort and time to do ReScript bindings for complex APIs.

Variant type and pattern matching: 

The best feature of ReScript that I came across was its variant types and pattern matching feature. It helps to deal with logic errors that occur in JS because of NULL or UNDEFINED values but ReScript doesn’t allow NULL values and   Variant type in ReScript helps in achieving this very goal. Have a look at how null value is beautifully taken care of using Option type and Variant. Notice the option, Some, None keyword.

Cons: when dealing with pattern matching one has to make ensure to take care of all cases otherwise compiler throws errors.

Modules:

Each ReScript file is a module in itself with the same name and is accessible to every other ReScript module. So,  Unlike Reactjs there is no need of importing and exporting of modules and functions.

For example a variable name myVariable in Test. res can be accessed like this Test.myVariable in other files.

Community & Documentation:

The ReScript is a new language with a growing community and with mediocre documentation. A newcomer like me had to struggle a lot as there are very few solutions and approaches available on the internet for ReScript bugs.

Compilation time:

For the first time as a ReScript user, I had to wait for more than  1 min every time to compile code, giving me an irritating feeling.

Use of React-Leaflet library and Next js Dynamic Importing :

I worked on the implementation of the world Map on the ‘Academic page’ using React-leaflet Map. As discussed earlier, in ReScript, for using JS libraries or third-party APIs in the project there is a need to create ReScript binding for that API/Library. For the leaflet library, one ReScript binding file was created. Since my project also uses Next.Js, there was an error in rendering Map(leaflet containers ) in the browser. 

Next.js uses SSR- Server Side Rendering while React-leaflet uses CSR-Client Side Rendering. Hence one conflict arose as the leaflet failed to find Windows objects in SSR. This problem was solved by the functionality of Dynamic import in NextJs. 

NextJs provides an advanced feature Dynamic Import by which JS modules can be dynamically imported in the browser when the web page loads. With the help of this functionality, the Leaflet map was successfully loaded in the browser.  Below is the code snippet of ReScript Binding for the next/dynamic functionality.

ReScript Bindings for next/dynamic function
World Map with Universities marked on it: ReScript Bindings, React-Leaflet, and NextJS Dynamic Import

My experience with OCaml syntaxes:

My very first task during the internship was to work on the OCaml/ood repo to import all required data for the academic webpage from the old repo. I got the opportunity to work with OCaml, Yaml, and markdown files. Here is a code snippet of my work:

 image of code snippet of academic_institution.mli (where acad page data is stored )

Some of My major PRs/work in ReScript:

Implemented the web design for Academic Excellence Webpage using ReScript and Tailwind and using some react hooks. Made my second major PR.

Figma design for academic_excellence page by web designing team
 webpage created by me using Rescript and Tailwind

Implemented the design of the Industrial Users page with improved readability of code. Made my third major PR.

 Figma design for Industrial Users page by web designing team
webpage created by me using Rescript and Tailwind

code snippet of the Industrial users’ web page written in ReScript and Tailwind

My open-source experiences takeaways:

The best part of Open Source is anyone can contribute. You are not required to be a pro in the field. The open-source community especially the OCaml community where I worked were very helpful and friendly. I could ask doubts to any of the OCaml members and they were always ready to help me. Open source helped me enhance my tech skills and provided me with a wonderful experience working on a real-world project. I interacted with people from different countries, communities and also got to work with the web design team. These all experiences have helped me enhance my personality development and coordination and teamwork skills.

Once I asked my mentor- what’s the inspiration behind working in the open-source? And he replied that it gives him satisfaction when people use his contributions for free. By doing this,  he is helping others and creating a positive impact on technology and as a result in people’s lives directly. And yes this is what Open Source actually is!

Tips for Upcoming Interns:

Open Source is the best platform to showcase your technical skills, where you can help people directly with the contributions, and Outreachy provides a better platform to grow and learn. You need not be pro in any technical skills all that matters is the quest for learning and improvement.

Never afraid to ask questions and seek help from the community members. Before asking any question to mentor first research on the topic, if not able to solve in 4-5 hours then ask.

My Takeaway from this internship:

I was fortunate to do my first internship in Outreachy with the very supportive and friendly members of the OCaml Organisation. I got an opportunity to work with the web design team along with the backend and frontend teams. I have learned many technical skills and gained confidence in web development and enhanced my network. I admire my mentors a lot for their leadership skills and helping nature. I never felt any pressure while working on the project under their guidance. They are the most lovable people I’ve ever met. I will miss Outreachy and its community. 🥺

Modifying Expectations

We have a strategic plan.It’s called “doing things.”

~Herb Kelleher

Hello world!🤗

In this blog, I’ll talk about project expectations,planning and timeline. As it goes by saying that “an hour of planning can save you 10 hours of doing“.Taking this into consideration, in outreachy interns have to propose a project timeline that includes work goals set to achieve during our internship.

Initially, I had proposed a project timeline on which I wanted to work during my intern period but had to change my timeline as a similar new project was announced by mentor and I was asked to work on the new one.

Since the project and its tech stacks were new to me,I was given two weeks to accomodate myself with the new codebase and learn the required tech stacks.For this my mentors provided me resources to learn and guided me every time I got stuck.We then moved on setting project on my local machine. That’s how my first three weeks of internship went.Finally, I became comfortable with codebase and learnt all required tech stacks.😎

My mentors have given me freedom to work on what I like. So, I chose a github issue by myself and got permission to work on. it was about implementing a webpage design using ReScript and react and fetching the required data for this webpage from old repository using OCaml packages.

I worked on fetching data and made my first Pull request. After that I implemented the web design and created the desired webpage.

After completion my first work I created another webpage and the moved on learning react-leaflet for implementation of a World Map on a webpage with ReScript bindings.

Currently, I am working on accessibility of website and learning Pa11y CI tool and gitHub actions to integrate accessibility tool with GitHub.

I expected to learn a lot during my internship and yes I am learning a lot. I am enjoying my new project timeline and hoping to finish my works in timeframe.

Thank you for reading!😊

My Project at OCaml

Hello world! 🤗

In this blog, I’ll answer some general questions regarding my community OCaml organization and my project.So let’s get started.😊

What is OCaml and What kind of people participate in OCaml community?

OCaml is a general purpose programming language with an emphasis on expressiveness and safety.It is principally maintained at INRIA (French Institute for Research in Computer Science and Automation), it has an advanced type system that helps catch your mistakes without getting in your way. It is supported by an active community, and has a rich set of libraries and development tools.Mostly functional programmers or people that enjoy functional programming are a part of the community.

OCaml is a strongly typed functional programming language, in the same niche as Haskell, Scala or F#. If you had been looking for an opportunity to practice a functional programming language with a powerful type system, participating to the OCaml community would be an excellent choice.

What problem is your community trying to solve?

The OCaml community is trying to find the best way to combine safety and expressiveness in a language, i.e., they are trying to find a meeting point between mathematics rigor and human creativity in programming.The community contributes to the implementation of the language, as well as the surrounding ecosystem of tools and libraries.

How does your project fit into the larger community?Why would people want to use your project?

With its strong security features and high performance, several companies rely on OCaml to keep their data operating both safely and efficiently.Companies like Jane Street, Facebook, Docker, Bloomberg, Citrix, and a lot more use Ocaml.

I am working on launch of V3(version) of main OCaml.org website in order to support some new features coming to OCaml such as Multicore Support.My main tasks are to implement web designs,work on accessibilty by integrating it with GitHub action and importing data from old repository using OCaml packages.The website uses ReScript and React for its frontend framework. Using ReScript, you can access the vast JavaScript ecosystem and tooling but without the warts, with a great type system, and with a lean build toolchain that doesn’t waste your time. It’s lot more faster than JS and has readable output .Other than this my project uses nextjs,tailwind(CSS library),OCaml etc.

What makes you most excited to work on your project?

The most exciting part of this project is I am working as a team with web designers and web developers. I have to implement the web designs made by designing team and it’s supercool task.Sometimes I undergo a lot of debugging and errors. But at last seeing the code running and getting merged to the site with positive feedback and appreciation from the mentors gives an immense pleasure and boosts confidence and excitation to complete new tasks.

What new terms or concepts have you learned in the past month?

Each day in internship, I learn new things. I learnt implementation of react leaflet using ReScript last week as a task to implement world map on a webpage. Currently, I am learning Pa11y CI accessibility tool with integration with GitHub action. I learnt many new terms in Git like rebase, cherry-pick commit, merge conflict resolving techniques etc. and others like use of makefile.

Thank you for reading.

Everybody Struggles

There is no gain without struggle.

Hello World!

It’s almost four weeks of my Outreachy Internship period and I’m having an amazing experience with my project so far. However, learning and experiencing new things invites a lot of challenges. I too struggle sometimes.

My struggle started when I had to start using Ubuntu for my project during the contribution period. I had very little knowledge of Linux commands.😅 So, making myself comfortable with Ubuntu was a new challenge for me.

My internship with Ocaml is all about improving their website. The tech stacks to build this project includes ReScript, React, Tailwind and OCaml, etc. And guess what? these all are new things to me 🤣 except React that I was familiar with before this internship was started.

So, the first two weeks went by learning and exploring these new things. But the real struggle came when I started working on my first issue. I had no idea what to do. Initially, I was hesitant to ask, since I didn’t have any particular questions, I was confused about almost everything. I began reading the documentation and exploring the codebase. Still, my efforts weren’t enough. Finally, I brought this up on a call with my mentors. They screen-shared and gave me an overall idea of the codebase and that was helpful indeed. I was able to raise my first PR.🎉

It’s ok to ask questions, never be afraid of asking for directions. Don’t be embarrassed or fake knowledge to look cool. Be brave and curious.😃

I love that my mentors gave me the freedom to work on what I like, they encourage me to ask questions whenever I got stuck in the code as every question is important. I am working on my next task and still struggling with many bugs, errors but this time I’m not afraid of asking for help from my mentors and thankfully they respond quickly.

So, here is the situation we all can relate to.😁

OpenSource Vocabulary Terms

I was introduced to many terms and concepts related to the OpenSource community when I started contributing. For instance, CI(Continuous Integration) tool, RSS feeds, and much Git-related stuff.

Let’s explore git pre-commit hooks.

Git pre-commit hooks:

Git provides hooks for events such as commit, push, receive, update, etc. The Git hook feature is built-in, no need to download or install anything. You can check these built-in hooks by running in ls .git/hooks in any git repository.

Pre-commit hook runs before typing the commit message. It’s primarily being used for linting or running tests to make sure everything is working. Pre-commit hooks are very helpful in maintaining the coding standards and productivity also as many of the suggested lint changes can be fixed automatically. It plays an essential role when multiple people are working on the same repo. The team can make sure everything goes to the repo passes the checks and balances put in place by using pre-commit hooks.

Here is the list of Git hooks: https://githooks.com/

The expert in anything was once a beginner.

So, let’s begin our journey in the OpenSource community and embrace the struggles to become an expert.😊

Thank you for reading.🤗

Hello, Outreachy!

The power of Open Source is the power of the people.The people rule.

-Philipe Kahn

Hello World!

The first week of my Outreachy internship has just started and I am really looking forward to a wonderful summer with OCaml!🎉🥳 I am woking on the project ‘Improve OCaml.org’ mentored by Patrick Ferris, Anil Madhavapeddy, Gargi Sharma and Bella.

I am Shreya Gupta from Bihar, India. I have just completed my sophomore year at Indian Institute Of technology, Patna. Here, I am pursuing Electrical and Electronics Engineering.

I am very fond of reading novels, watching political debates, and listening to music.I also like learning new language and reading culture and history of different places and countries. Currently, I am learning Spanish😊. I love chatting with my friends.😁

Core values that are important to me are Friendship, Determination and Curiosity.

Friendship is the most important core values and the one I give the highest priority.The reason is it itself comes with many important core values like love, trust, honesty, equality, peace and independence.It’s an opportunity to love, to learn about yourself, to mature as a human being, and to open up to the full experience of life. A friend is very vital for mental health.I’m blessed to have some lovely friends who always motivate and support me.😄

Determination enables us to persist in the face of difficulties.With determination, we can overcome any type of obstacle.For me being determined for something provides hope and courage not to give up until success.🙃

Curiosity is the very purpose of life. I love exploring and trying out new things. These include learning about different place’s cultures and history, learning new tech skills, etc.Being curious has made myself better and improved.✌

What motivated me for outreachy:

I came to know about contribution to Open source Software in my college.I joined some clubs of my college that motivates students to contribute to Open Source, there I got to know about Outreachy Summer Internship.

What I liked the most about Outreachy was the fact that it celebrates diversity and also it’s paid. Getting this internship would mean having a chance to meet the superheroes from all over the world who have been under-represented in their field. I was certain that this internship would provide me opportunities to connect people across the world and learn and explore tech skills required for my project.

Create your website with WordPress.com
Get started